1 year ago

#314203

test-img

Eric Movsessian

Outputing Unicode Values via different Output Encodings C#

I am experimenting with the Console Output Options and have noticed this:

Console.OutputEncoding = System.Text.Encoding.Unicode;
    Console.WriteLine("\u266F");
    Console.WriteLine("\u6F26");

So I set the Encoding to Unicode(UTF-16LE) and I am trying to output the sharp character "\u266F" This is the sharp in UTF-8 "\u6F26" This is the sharp in UTF-16LE

You can see the output in the screenshotenter image description here

So I have 2 questions

  1. Why does this "\u266F" output a sharp when It is in UTF-8 and I have set the Encoder to Unicode

  2. Why doesn't this output a sharp if it is in UTF-16LE and the Encoder is in UTF-16LE too.

c#

unicode

console-application

windows-console

0 Answers

Your Answer

Accepted video resources