Encoding bug

  • Автор темы Автор темы lokiys
  • Дата начала Дата начала

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 921
Реакции
1 206
Баллы
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
 
Последнее редактирование:
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
 
Последнее редактирование модератором:

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