Console.WriteLine Doesn't Support Turkish Characters In Dotnet Web Api Application

390 views Asked by At

In console app:

Console.WriteLine("şşşşşşşşşşşşşşşşşşş");

Output shows me in a correct way but when I write the same code line in dotnet web api

Output:

ÄŸÄŸÄŸÄŸÅŸÅŸÅŸÅŸÅŸ

What I've tried so far:

Console.OutputEncoding= Encoding.UTF8;

thanks for your efforts in advance.

P.S. sorry for grammar rules

1

There are 1 answers

4
Mithgroth On

Add Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);.

Normally this compiles as expected in .NET 6: https://dotnetfiddle.net/dkpMlY

However, you might be in an environment that extra encodings are not loaded. You can check the list with Encoding.GetEncodings();.