1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

@CHAR and UNICODE

Discussion in 'Support' started by mathewsdw, Aug 28, 2011.

  1. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    And I quote from the "help" system:

    @CHAR[n] : Returns the character corresponding to a Unicode numeric value.

    Well, that's what it says, but I can't get it to output a UNICODE character no matter what value I use as an argument, and I've tried everything I can possibly think of for well over an hour here. (I really need UNICODE characters for what I intend to do.)

    And on a similar, rather strange, note, the examples shown in the documentation for the @UNICODE function are all plain old ASCII!
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
    Code:
    echo %@char[8220]Don%@char[8217]t Panic!%@char[8221]
    echo %@char[0x201c]Don%@char[0x2019]t Panic!%@char[0x201d]
    
    If you don't see the Unicode curly quotes, then you are probably using a non-Unicode font. One non-obvious gotcha: In a Take Command window, both the tab window font and the underlying console window must be set to use Unicode fonts....
     
  3. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
    Oh yeah. If you're redirecting to a file, don't forget to OPTION //UNICODEOUTPUT=YES -- otherwise all your nice Unicode characters will be smashed right back to ASCII.
     
  4. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Thank you, Charles!!! I strongly suspected that something like that must be the case, but between my bad memory and bad eyes, I couldn't remember it/find it. (Although I would suggest that Rex mention something about it in the documentation for the @Char function...) But I'll note two things: 1. 99.99 percent of the time I don't want/need UNICODE, and 2. In the interim I wrote a C++ program (blah!) to do what I needed to do, but I will be glad to avoid that in the future!
     
  5. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
    Maybe, though it really isn't anything to do with @CHAR in particular; you'll see this behavior any time you use redirection. Perhaps UnicodeOutput should be mentioned in all of the help pages on redirection and piping?
     

Share This Page