Reputation: 12216
I am working with string delimiters and one of them is « or 174
. However, when I step through my code it looks like this in the debugger, ®, which is 0174
. See here for Codes.
This is how I'm doing it in code for reference:
string fvDelimiter = ((char)174).ToString();
Upvotes: 4
Views: 1681
Reputation: 16878
It is all about character encoding. 174
(AE
in hex) is ® in Unicode, which is used internally in string
by default. But it is «
in Extended ASCII code.
Please refer this difference in article you've provided:
Inserting ASCII characters
To insert an ASCII character, press and hold down ALT while typing the character code. For example, to insert the degree (º) symbol, press and hold down ALT while typing 0176 on the numeric keypad.
Inserting Unicode characters
To insert a Unicode character, type the character code, press ALT, and then press X. For example, to type a dollar symbol ($), type 0024, press ALT, and then press X.
Upvotes: 6
Reputation: 13765
For the simple reason that char
in c# represents a unicode
character code which match perfectly 0174 and not an ASCII
code which is 174
here a code to let you understand more what I mean
var chrs = System.Text.Encoding.ASCII.GetChars( new byte[]{0174});
var chrsUtf = System.Text.Encoding.UTF8.GetChars(new byte[] { 0174 });
var chrsUnicode = System.Text.Encoding.Unicode.GetChars(new byte[] { 0174 });
Debug.WriteLine(chrs[0].ToString());
Debug.WriteLine(chrsUtf[0].ToString());
Debug.WriteLine(chrsUnicode[0].ToString());
Upvotes: 1
Reputation: 6985
From what I have seen it is based on the font being used. On Windows I use "Character Map" to check them out. For example the "«" character in the font Calibri is 171.
Upvotes: 1