Fix garbled message text: Difference between revisions

Jump to navigation Jump to search
Line 140: Line 140:
Using Python<ref>[https://docs.python.org/3/library/stdtypes.html#bytes.decode bytes.decode()]</ref><ref>[https://docs.python.org/3/library/stdtypes.html#str.encode str.encode()]</ref><ref>[https://stackoverflow.com/questions/33294213/how-to-decode-unicode-in-a-chinese-text python - How to decode unicode in a Chinese text - Stack Overflow]</ref>
Using Python<ref>[https://docs.python.org/3/library/stdtypes.html#bytes.decode bytes.decode()]</ref><ref>[https://docs.python.org/3/library/stdtypes.html#str.encode str.encode()]</ref><ref>[https://stackoverflow.com/questions/33294213/how-to-decode-unicode-in-a-chinese-text python - How to decode unicode in a Chinese text - Stack Overflow]</ref>
<pre>
<pre>
data = u""
data = u""
data
data
hex_notation = data.encode('utf-8')
hex_notation = data.encode('utf-8')
hex_notation // print b'\xe8\xa8\xb1'
hex_notation
# print b'\xe8\xb1\xa1'
for each_unicode_character in hex_notation.decode('utf-8'):
for each_unicode_character in hex_notation.decode('utf-8'):
     print(each_unicode_character)
     print(each_unicode_character)
Line 151: Line 152:
data
data
hex_notation = data.encode('utf-8')
hex_notation = data.encode('utf-8')
hex_notation // print b'\xe3\x81\xa0\xe3\x81\x84\xe3\x81\x98\xe3\x82\x87\xe3\x81\x86\xe3\x81\xb6'
hex_notation  
# print b'\xe3\x81\xa0\xe3\x81\x84\xe3\x81\x98\xe3\x82\x87\xe3\x81\x86\xe3\x81\xb6'
for each_unicode_character in hex_notation.decode('utf-8'):
for each_unicode_character in hex_notation.decode('utf-8'):
     print(each_unicode_character)
     print(each_unicode_character)

Navigation menu