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

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



Solution 1:[1]

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();.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mithgroth