@CHAR and UNICODE

May 24, 2010
855
0
Northlake, Il
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!
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,950
53
Albuquerque, NM
prospero.unm.edu
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.)
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....
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,950
53
Albuquerque, NM
prospero.unm.edu
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.
 
May 24, 2010
855
0
Northlake, Il
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.
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!
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,950
53
Albuquerque, NM
prospero.unm.edu
(Although I would suggest that Rex mention something about it in the documentation for the @Char function...)
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?