C
C#9mo ago
Darkisad

problem with encoding cyrillic

ive been trying to fix it for a long time
No description
No description
3 Replies
SpReeD
SpReeD9mo ago
You're using UTF8, try windows-1251 which is for cyrillic
Darkisad
DarkisadOP9mo ago
thank so much
SpReeD
SpReeD9mo ago
If you cannot access any codepage besides the default ones (seven codepages), you gotta execute this line first: Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);, depending on which framework you're using you might need to install a nuget package, if you're on .NET6+ you're fine. Here's an example:
string a = "Привет";

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

byte[] b = Encoding.GetEncoding(1251).GetBytes(a);
string c = Encoding.GetEncoding(1251).GetString(b);
string a = "Привет";

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

byte[] b = Encoding.GetEncoding(1251).GetBytes(a);
string c = Encoding.GetEncoding(1251).GetString(b);
Want results from more Discord servers?
Add your server