Answer the question
In order to leave comments, you need to log in
How to convert ANSI to UTF-16 LE?
How to convert ANSI to UTF-16 LE ( little_endian) ?
We need a way to translate into any of these languages.
Answer the question
In order to leave comments, you need to log in
little endian - after each ASCII character, insert a character with code 0. big endian - before each ASCII character, insert a character with code 0.
var asciiBytes = File.ReadAllBytes(fileName); // допустим, что мы читаем текст из файла.
var text = Encoding.ASCII.GetString(asciiText); // Переводим байты ASCII в текст
var utf16leBytes = Encoding.Unicode.GetBytes(text); // Переводим текст в байты UTF-16LE
Encoding.ASCII
, but Encoding.GetEncoding(1251)
, for example, if you really need win-1251.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question