TCC smashing Unicode quotes

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,570
46
Albuquerque, NM
prospero.unm.edu
#1
What's going on here?
Code:
C:\>ver /r

TCC  22.00.40   Windows 7 [Version 6.1.7601]
TCC Build 40   Windows 7 Build 7601  Service Pack 1
Registered to COE-DDPTMHQ1

C:\>set test=%@char[0x201c]Test%@char[0x201d]

C:\>set test
"Test"

C:\>echo %@ascii[%test]
34 84 101 115 116 34

C:\>
At first, I thought this was a font issue, maybe the console using an OEM font. But no. It seems that TCC is replacing Unicode quotes with ASCII.
 
#3
My console font, Andale Mono, supports both 0x201c (double left quotation mark) and 0x201d (double right quotation mark). With TCC, 0x201c does not display correctly, while 0x201d does display correctly.
1522800766940.png

Powershell gets them both right (in the same console as above).
1522800966794.png
 
#5
WAD. TCC uses Unicode quotes to pass quoted arguments to tab completion functions.
This bit of code prints them correctly.
Code:
    WCHAR str[3] = L"\x201c\x201d";
    SetEnvironmentVariable(L"uq", str);
    GetEnvironmentVariable(L"uq", str, 3);
    Printf(L"%s\r\n", str);
This bit of code prints them incorrectly.
Code:
    WCHAR str[3] = L"\x201c\x201d";
    WCHAR cmd[32];
    Sprintf(cmd, L"set uq=%s", str);
    Command(cmd, 0);
    GetEnvironmentVariable(L"uq", str, 3);
    Printf(L"%s\r\n", str);

What does that have to do with arguments to tab completion functions? It seems more like SET is doing it.
 

rconn

Administrator
Staff member
May 14, 2008
10,494
94
#6
What does that have to do with arguments to tab completion functions? It seems more like SET is doing it.
No, it is the code that parses the line into argv/argc format. SET doesn't have anything to do with it; internal commands do not parse quotes.

You can work around it with a SETDOS /X-7 before the SET.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,570
46
Albuquerque, NM
prospero.unm.edu
#7
WAD. TCC uses Unicode quotes to pass quoted arguments to tab completion functions.

Why do you want to echo Unicode quotes?
ECHOing them would be purely cosmetic, of course. But I can't do other things either, like stashing them in environment variables. And note that the curly quotes, unlike the ASCII double-quote character, are valid (if weird) in filenames.