How to store a UTF-16 character as a string in c#?

2

How can I print a character whose UTF-16 representation is feff2031?

When I try the following I get "?" as the result:

String million = "\u2030";

The character I want is "per million". See PER MILLE for more information.

UTF-8 (hex)     0xE2 0x80 0xB0 (e280b0)
UTF-8 (binary)  11100010:10000000:10110000
UTF-16 (hex)    0x2030 (2030)
UTF-16 (decimal)    8240
UTF-32 (hex)    0x00002030 (2030)
UTF-32 (decimal)    8240
C/C++/Java source code  "\u2030"
Python source code  u"\u2030"
c#
utf
asked on Stack Overflow Nov 14, 2011 by tequilaras • edited Nov 14, 2011 by Matt Hulse

2 Answers

3
        label1.Text = "\u2030";

That shows up in a windows form I just tried;enter image description here

answered on Stack Overflow Nov 14, 2011 by McKay
0

Encoding.Unicode.GetString(bytes);

answered on Stack Overflow Nov 14, 2011 by McKay • edited Jul 30, 2012 by burning_LEGION

User contributions licensed under CC BY-SA 3.0