This is a discussion on Extended ASCII Characters in an RTF Control within the C Programming forums, part of the General Programming Boards category; Originally Posted by JustMax Can you tell me which key I press for the top left corner of a box ...
Hope is the first step on the road to disappointment.
How would I set the control to use the correct codepage?
Windows API's use 2 different character representations. There's the "ansi" or "asci" or "narrow" representation which uses 8bit code points or character codes. Each character code is used as an index into a code page table to determine the glyph to use for that character code. All Windows code pages use the same glyph for code points 0x00 to 0x7F. So 'A' is always 0x41 in all code pages, etc...
The other character representation is "wide" or Unicode using UTF16LE as the encoding. Think of Unicode as a globalized/standardized code page - where all Unicode characters (and their glyphs) are assigned a unique code point.
Many Windows API functions come in 2 flavors - "Ansi" and "Wide". For example there's SetWindowTextA() and SetWindowTextW(). SetWindowTextA() converts the given string to Unicode and calls SetWindowTextW(). The conversion is done using the system "Ansi Code Page" (ACP). The ACP is a system setting that you don't modify. Since you don't know what the ACP will be, it doesn't make sense to hard code an "extended" (greater than 0x7F) character code - since the ACP determines the resulting glyph. If you hard code a Unicode character, there's no need to worry about conversions or code pages.
>> once I save the project and re-open it, the editor changes the characters to "+" and "-"
Using character literals with a code point greater than 0x7F can easily go wrong. First there's whatever editor the developer is using and how it decides to save the source file. Then the compiler has to read it and decide how to map it to the "execution character set" (which is "implementation defined" by the way). So it's best to stick with your basic asci character set in source code.
Now that you know how to represent the glyph your want to render, you just have to make sure the font you're using supports that glyph. Run "charmap.exe" and type in the Unicode code point to see if a font supports a glyph.
Here's a quick reference of Unicode code point values for box drawing characters: Selected Unicode Characters 2500-25FF
Here's how you would define one in code:
ggCode:const wchar_t Box_DownRight = L'\u250C';
Finally, an answer instead of a question or a debate! Thank you so much.