Phoniex
Phoniex

Reputation: 301

Char code is different between .NET 4.8 and .NET 6

Previously with VB.NET (.NET 4.8) I have read files with the encoding windows-1252 in that way:

File.ReadAllText(filePath, Encoding.GetEncoding(1252))

Now in my ASP.NET Core 6 application I'm reading the same file with the same code converted to C#:

 File.ReadAllText(filePath, Encoding.GetEncoding(1252));

For a special char inside the file VB.NET returns char-code char = 132 and ASP.NET Core 6 returns char = 8222. Why is the code different and how can I fix it?

I have already followed this question. I have added the package and registered the provider, but this doesn't change anything - it the same behavior with or without.

Upvotes: 0

Views: 102

Answers (0)

Related Questions