Extended ASCII Characters in an RTF Control

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 ...

  1. #16
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by JustMax View Post
    Can you tell me which key I press for the top left corner of a box outline? My keyboard doesn't seem to have any of these keys :
    Since you knew that they're extended characters already, I assumed you were smart enough to know what the character mapper is, or how to enter extended characters. I'll be sure not to make assumptions as to your intellect in the future.


    Quzah.
    Hope is the first step on the road to disappointment.

  2. #17
    Registered User JustMax's Avatar
    Join Date
    Jan 2009
    Posts
    59
    brewbuck,
    How would I set the control to use the correct codepage?

  3. #18
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    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:
    Code:
    const wchar_t Box_DownRight = L'\u250C';
    gg

  4. #19
    Registered User JustMax's Avatar
    Join Date
    Jan 2009
    Posts
    59
    Finally, an answer instead of a question or a debate! Thank you so much.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ascii characters
    By Denethor2000 in forum C++ Programming
    Replies: 3
    Last Post: 03-20-2002, 04:26 AM
  2. Printing extended ASCII characters
    By Jonny M in forum C Programming
    Replies: 2
    Last Post: 03-01-2002, 09:12 AM
  3. Printing characters not in the ASCII table
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 01-21-2002, 12:47 PM
  4. Using Control Characters in Unix
    By jharley in forum C Programming
    Replies: 2
    Last Post: 12-06-2001, 08:17 AM
  5. ASCII characters
    By NuKid in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2001, 08:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21