1 year ago

#307732

test-img

Michał Plich

Save file as Unicode in C# stopped working as expected

I have demo file Encoded UTF-8, which includes special characters: enter image description here

I had solution which was converting this file to Unicode (This conversion is necessary so data was displayed by MS Excel correctly):

 string fileContent = File.ReadAllText(inputFilePath, Encoding.Default);
    File.WriteAllText(outputFilePath, fileContent, Encoding.Unicode);

It worked just fine for a long time, but suddenly it stopped working. Currently after conversion data is displayed rubbish: enter image description here

I've noticed that data is saved now as UTF-16 LE. Any ideas what is causing this issue?

c#

utf-8

type-conversion

utf

0 Answers

Your Answer

Accepted video resources