D
D
Dmitry Korolev2018-11-26 16:24:45
C++ / C#
Dmitry Korolev, 2018-11-26 16:24:45

How to write any characters through unicode?

Faced with the problem that the Russian char writes through binarywriter unicode and the English char writes using a single-byte encoding
What needs to be done so that the output of any character is through unicode?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
shai_hulud, 2018-11-26
@adressmoeistranici

Create a BinaryWriter with unicode encoding
// public BinaryWriter(Stream output, Encoding encoding);

new BinaryWriter(output, Encoding.Unicode);
// или
new BinaryWriter(output, Encoding.Utf8);

or directly convert characters to bytes.
Encoding.Utf8.GetBytes("мазафака");

S
Stanislav Makarov, 2018-11-26
@Nipheris

and the English charm writes using a single-byte encoding

Are you REALLY sure that this is WRONG? How do you distinguish English char in UTF-8 from English char in ASCII?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question