Search found 3 matches

by LabBaxMX
Mon May 30, 2022 10:23 am
Forum: Programs, Libraries and Tools
Topic: Confused about micropython's utf-8 encoding
Replies: 4
Views: 4395

Re: Confused about micropython's utf-8 encoding

I suspect your source file (the first code block – you don’t show any >>> prompts so I guess this is a source file, not REPL input) isn’t actually encoded in UTF-8. Can you open it in a hex editor and see what bytes are there in the '冯' string literal? With the amount of encoding-unaware tools arou...
by LabBaxMX
Mon May 30, 2022 10:01 am
Forum: Programs, Libraries and Tools
Topic: Confused about micropython's utf-8 encoding
Replies: 4
Views: 4395

Re: Confused about micropython's utf-8 encoding

Are you sure? I get the correct UTF-8 running on a ESP32: >>> data_code = '冯'.encode('utf-8') >>> print (data_code) b'\xe5\x86\xaf' >>> Thank you for your reply, I tried another IDE (Thonny), and this problem disappeared, the mismatch problem only occurred when I use VS Code XD, now I just use VS C...
by LabBaxMX
Sat May 28, 2022 11:56 am
Forum: Programs, Libraries and Tools
Topic: Confused about micropython's utf-8 encoding
Replies: 4
Views: 4395

Confused about micropython's utf-8 encoding

Hello there, I'm new to this forum :D I'm trying to make my LCD driver(st7735s) to support Chinese letters. My solution is to encode a Chinese letter and get its utf-8 format code, then use this code and a key to search in a dict that contains all the letters used in my project. letter_dict = { 0xe5...