@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
4,495
91
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
4,495
91
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
4,495
91
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?
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Putting @char[160] (nbsp) in the clipboard? Support 24
Alpengreis [TCMD v25.00.24] Problem with copy and paste and the # char via mouse in TCC Support 6
R Processing CSV file, hit = char and stops Support 9
jbarnes1967 Disable wildcard [ char in destination Support 10
aedthuio Folder with space char Support 6
M A little bit of strangeness with @Char... Support 3
Stefano Piccardi char class wildcard issue when [] in path Support 14
Peter Murschall TEE cannot handle Unicode output Support 2
B Fullwidth Unicode forms display incorrectly Support 5
T @execstr unicode support Support 6
Peter Murschall TPIPE generate unicode on Piping or redirecting Support 3
D Pasting Unicode data has different behavior on TCC and CMD Support 2
vefatica TYPE goes crazy with no-BOM Unicode file Support 7
Charles Dye TCC smashing Unicode quotes Support 9
Peter Murschall UNICODE mixed with ANSI Code Support 11
Joe Caverly Unicode, Codepage 437, and line characters Support 3
B How to? Convert Unicode to ANSI Support 1
StarliteLemming Fileread fails on Unicode file Support 10
vefatica DO ... /P ... and Unicode? Support 3
vefatica Unicode ... I don't understand Support 1
jadaml Echo unicode characters from UTF-8 Batch files? Support 1
Charles Dye @ASCII vs. @UNICODE Support 5
A How to? Filter history list with unicode chars Support 0
vefatica TYPE, Unicode, installer Support 10
A WAD Limitations on display of unicode punctuation marks Support 11
A Include lists and Unicode Support 1
M How to? How do I read a Unicode file through standard-input? Support 4
M WAD A bit of strangeness related to Unicode-marked file not being Unicode Support 2
D LIST command wierdness with empty Unicode file Support 1
B Unicode/dword issue in TCC12 Support 4
J dir failure with some unicode characters Support 6
M TCC Unicode support? Support 7
vefatica BOMs in [dir]history / TAIL with Unicode Support 2
vefatica Unicode screw-up in IDE Support 4
vefatica Unicode anomaly Support 0
vefatica Debugger now Unicode? Support 1
vefatica TYPE /X and Unicode files? Support 0
dcantor Convert ASCII to Unicode or vice versa? Support 6
H HISTORY and DIRHISTORY /R can't handle Unicode Support 0
R Reading an Unicode file with more than 8191 lines Support 1

Similar threads