TCC smashing Unicode quotes

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,466
88
Albuquerque, NM
prospero.unm.edu
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.
 
May 20, 2008
11,414
99
Syracuse, NY, USA
It gets even stranger.
Code:
v:\> set uq=%@char[0x201d]%@char[0x201c]

v:\> echo %@ascii[%uq]
8221 34

v:\> set uq=%@char[0x201c]%@char[0x201d]

v:\> echo %@ascii[%uq]
34 34
 
May 20, 2008
11,414
99
Syracuse, NY, USA
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
 
May 20, 2008
11,414
99
Syracuse, NY, USA
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
12,363
150
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
4,466
88
Albuquerque, NM
prospero.unm.edu
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.
 
Similar threads
Thread starter Title Forum Replies Date
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
C COMSPEC constantly reset to TCC.EXE Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
C How to? starting TCC/TCMD v25 Support 2
CWBillow TCC and TCMD in Powershell Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
Alpengreis Fixed Crash after copy dialog with big TCC.exception.log Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
L FTYPE in TCC, less quirky than in cmd.exe Support 3
V Set path permanently from within TCC? Support 3
DrusTheAxe Runaway TCC.exception.log filling drive Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
Joe Caverly tcc.exception.log Support 3
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
vefatica SCRIPT ... TCC disappears Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
Jesse Heines Access Denied errors in TCC 27 Support 9
fpefpe How to? tcc inifile (%_ininame) Support 3
M How to? Black TCC Prompt Support 2
D Differences between TCC and CMD with COPY /b Support 4
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
Jay Sage Extra TCC Tasks Support 6
vefatica Can I turn off the minimize to tray mechanism in TCC? Support 5
N Command execution slows down in TCC Prompt after a while Support 6
R Upgrade TCMD 19 to TCC 26 Support 1
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
samintz How to? Is this doable in TCC? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.02.41 Uploaded Support 0
D TCC tab detaching & restarting Support 3
Ó Recent git output not shown on TCC Support 1
P Kill all other instances of tcc from a btm batch file Support 2
L Using TCC.exe through an SSH connection Support 3
M TCC color issue in ConEmu Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
Alpengreis Python support for 3.8.3 in TCC v26.x? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.01.40 uploaded Support 0
Peter Murschall TCC V26.01.3x Debugging has problems with Alias /R Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 26.0.37 Uploaded Support 0
vefatica TCC waits for Office apps Support 4
Joe Caverly .BAT works in TCC-RT 25, but not in TCC-RT 26 Support 4
M Strange error messages from TCC in FTP copy Support 7
Kachupp Documentation tcc-rt versions Support 1
V Comments from a first-time user (TCC 26) Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT 26.0.28 Support 0
C TCC 26 BATCOMP BTM problems? Support 5
E TCC/CMD difference Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT Public Beta RC2 Support 0

Similar threads