C
C#2y ago
PJB

❔ Are Windows console encodings just broken out of the box??

I'm trying to print Cyrillic to Windows terminal, and .NET turns it into question marks with the simplest code. Python can do it fine, on the other hand. Am I missing something here?
4 Replies
PJB
PJBOP2y ago
I guess Python changes the console encoding to UTF-8 whereas .NET just doesn't? ugh. I could do it manually with SetConsoleOutputCP but I'd rather not
Angius
Angius2y ago
Yeah, you need to set the encoding by hand. Thankfully, you just need to do it once
Console.OutputEncoding = System.Text.Encoding.UTF8;
Console.OutputEncoding = System.Text.Encoding.UTF8;
PJB
PJBOP2y ago
o-oh you can just set that directly makes another commit that doesn't use P/Invoke
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server