Thread: Where is my UNICODE extended wide character ?

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    20

    Where is my UNICODE extended wide character ?

    Hello,

    I am writing here because I can no wprintf() the BOX DRAWING SET character under Linux.

    When I specify character number arround U+0x2500 I obtain a "+" character as box corner ; not a real corner. As horizontal line I get "-" (minus) instead of full line. My drawn line contains blank not full line.

    I have set many times the "setfont" command but no effect.

    Some times I can obtain character set by typing ALT+number but this number is far away of BOX DRAWING SET range according to the UNICODE table then I have not port this number inside my code.

    My code look like this:

    #include <wide char>
    #include <stdio>
    #include <locale>

    wchar_t t;

    t= arround 0x2500;
    wprintf(L"%lc\n", t);


    Thank you.

  2. #2
    Sr. Software Engineer filker0's Avatar
    Join Date
    Sep 2005
    Location
    West Virginia
    Posts
    235
    It seems that you've got the right character set support, but no font integrated to go with it. Fonts and character sets are very different things -- a font is mapped onto a character set (or is it the other way around?) so that each glyph is associated with a position (or code) within the character set. The meaning of the character is defined within the character set. Lacking a font that maps directly to a position within the Unicode character set, a good implementation will make an attempt to represent that meaning the best it can with glyphs that may best convey the intended meaning of the character. In your case, the font you're using does not have the line drawing glyphs, so it's substituting.
    Insert obnoxious but pithy remark here

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    20
    May be the line and corner are replaced by - and +, but when I typed <ALT+some number> I can see them. How can you explain that, I am wondering if the set are duplicated in the same font.

    Also, I can not insert these number inside my code: I get wrong character.
    Last edited by intmail; 02-15-2006 at 01:22 AM.

  4. #4
    Sr. Software Engineer filker0's Avatar
    Join Date
    Sep 2005
    Location
    West Virginia
    Posts
    235
    It could be that the terminal window (or whatever program you're using) doesn't have a good map between the font that it's using and the character set encoding (which I assume is Unicode). The fact that it's not printing little square boxes or dots for all of those glyphs, but instead is attempting to make something that will look something like the intended representation means that it is doing some mapping or another.

    What terminal program are you using as your command line? What are its character set encoding settings? It's font settings? Is your localle set up properly? All of these may effect this sort of thing.

    (By character set encoding, I mean UTF8, UTF16, us-ascii, ISO-latin-1, etc. The font is the typeface.)
    Last edited by filker0; 02-15-2006 at 10:23 AM.
    Insert obnoxious but pithy remark here

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. (VC++ related) Unicode or Multi-byte environment?
    By PaulBlay in forum C Programming
    Replies: 3
    Last Post: 05-22-2009, 08:42 AM
  2. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 04:23 AM
  3. unicode character recognitions
    By technosavvy in forum C Programming
    Replies: 2
    Last Post: 03-10-2008, 08:01 AM
  4. get wide character and multibyte character value
    By George2 in forum C++ Programming
    Replies: 27
    Last Post: 01-27-2008, 05:10 AM
  5. <string> to LPCSTR? Also, character encoding: UNICODE vs ?
    By Kurisu33 in forum C++ Programming
    Replies: 7
    Last Post: 10-09-2006, 12:48 AM