-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Read Russian text in console #47133
Comments
Most likely your terminal input is not UTF-8. It could be Windows-1251. In that case, all the characters you input have codes >= 128, and most >= 160, which means that the bytes are likely to be invalid UTF-8. UTF-8 decoding then either fails, or if being lenient, gives you a replacement character, which could explain the Try decoding with a Cyrillic code page instead of UTF-8, possibly (Or maybe it's something else, but try this first, or show us the actual bytes you receive from |
My windows terminal (cmd, powershell) is running in (utf-8 65001) mode, so this shouldn't be a problem. I also looked at the actual bytes that come to me from stdin, all the same zeros. I tried setting the BUT I decided to open not the Windows terminal - git bash, and run my code, it did not work with the When I find out I will write here and close the issue, or can you help me if you know the answer :) |
As it turned out, I have a problem with all windows terminals, even if I put internal git bash in vs code, then nothing will work, it will only work if I open external git bash |
Hey! @cocahonka Please reopen the issue - it's still there. Not only you have problem - no one on Windows can read input in cyrillic. It's quite critical for cross-platform CLI tools. |
//cc @aam |
I don't think this issue has much to do with Dart rather with very complicated story of how encoding works in Windows Command line prompt/Powershell. You can check https://stackoverflow.com/questions/57131654/using-utf-8-encoding-chcp-65001-in-command-prompt-windows-powershell-window to get a sense of what's involved in using utf8 in windows shell. |
@aam Thanks for the answer and link! Encoding in Windows are truly horrible, but I'm still think that's a Dart problem. That why:
So it's just unusable on Windows and we can't get it working from Dart code or system/environment settings. |
Right, and it has little to do with Dart. You will get the same if you use
|
Faced a similar situation while rewriting one console program from node js to dart.
In dart app: |
How can Russian text be read from the console? I tried like this
and like this
stdin.transform(utf8.decoder);
but if you try to print a string using print, then nothing will be output.
Additional:
I enter simple words:
The text was updated successfully, but these errors were encountered: