-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pybricks Code hub stdout to terminal is not UTF-8 aware #1743
Pybricks Code hub stdout to terminal is not UTF-8 aware #1743
Comments
The problem is that data sent from the hub gets split up into 20 byte packets. If a multi-byte character gets split, Pybricks code currently isn't catching that and print two or more invalid characters instead of recombining the data into whole characters. |
Enable the stream option on the text decode for the stdout and uart stream handlers that pipe data to the terminal. This fixes improperly printing multibyte unicode characters that get split across multiple data packets. A new decode is added for each different stream in case both are used at the same time. Fixes: pybricks/support#1743
Enable the stream option on the text decode for the stdout and uart stream handlers that pipe data to the terminal. This fixes improperly printing multibyte unicode characters that get split across multiple data packets. A new decode is added for each different stream in case both are used at the same time. Fixes: pybricks/support#1743
I was going to add an example for @angzicn to say 很高兴认识你 (我学习中文) but bonus points for extra effort go to @BertLindeman 😄 Love it - thanks for sharing! I suppose you can make an animated story now. I think we support \r. Is there a sequence to go back a line? Thanks @dlech for fixing this! |
Animated, I do not know, but I can share the program (need to cleanup all debugging) There are domino-stone images that could be animated. The \r worked before this update and I did not yet try it on this beta. |
And much, much more: https://xtermjs.org/docs/api/vtfeatures/ |
Misunderstood you Laurens, you were just stating the fact, not asking me to...., 😄
I use ANSI codes as an example to show xbox controls sent by an disconnected Technichub on some other hub. Added the UTF-8 print program in discussion #1882 . |
Discussed in https://github.com/orgs/pybricks/discussions/1742
Originally posted by angzicn August 6, 2024
Thank you, I'm a Chinese pybricks fan and I want to teach my son use pybricks to make python code.
Can i print the Chinese str in the online terminal?
There is something wrong with the Chinese str printing in the terminal.
incomplete display, like this↓
thank you!
The text was updated successfully, but these errors were encountered: