Encoding bug

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 771
Благодарностей
1 183
Баллы
113
How to reproduce:

Very easy - save file in UTF-8 take all lines from file, when file gets empty encoding changes to ANSI automatically.

WORKAROUND:

Save line in file using c# and line will be saved in UTF-8 without BOM

JavaScript:
string path = @"C:\MyTest.txt";

// Append text in UTF-8
using (System.IO.StreamWriter sw = System.IO.File.AppendText(path))
sw.WriteLine("Hello World");
Cheers
 
Последнее редактирование:

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Very easy - save file in UTF-8 take all lines from file, when file gets empty encoding changes to ANSI automatically.
It should be changed to UTF when you add new data .

Sure i already added workaround in first post, and this is not problem for me, but users without c# knowledge can not accomplish that.

Cheers
 
Последнее редактирование модератором:

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)