Hi everyone.
So first time in my life I have an issue with encoding in C#
I have telegram library which uses mtproto to Send Messages and Receive Reply, nothing special.
But C# doesnt recognize encoding (what?) that UTF-8 for sure, AND debugger sees text with no problem, but any output (Console.WriteLine, Web response with same data) returns
Where is suppose to return
Screenshot:
https://imgur.com/a/idrbfmp
I tryed to manually Encode to UTF-8 from bytes etc, nothing works.
Any thoughts?
Thanks in advance!
UPDATE
It wasnt C# issue, just updated Visual Studio last night and even
returns wrong charset where it was fine before update.
Make sure the source code file is saved with UTf-8 encoding. Use File -> Save As -> Save With Encoding (dropdown button)
UTF-8 strings sometimes have a prefix. If there’s a mismatch between what’s present and what you expect then you will get garbage.
https://stackoverflow.com/questions/53009692/utf-8-encoding-why-prefix-10
I found a problem, its not a C# issue. More info in updated post.
UTF-8 strings, not really, but files may have it. If a string has it, it’s probably been read improperly from a file. Also, this whole business is a Windows “feature” :/
C# devs
null reference exceptions