Reputation: 1403
In a C# console app, I am using stringbuilder to write data to a local file. It seems to be mishandling special characters
Muñoz
outputs to the file as
Muñoz
at a bit of a loss how to manage that correctly.
Upvotes: 0
Views: 1407
Reputation: 887215
Your C# code is correctly writing a UTF8 file, in which ñ
is encoded as 3 bytes.
You're incorrectly reading the file as a different encoding which shows those bytes as three unwanted characters.
You need to read the file as UTF8.
Upvotes: 5