Charles Dye
Super Moderator
- May
- 5,226
- 149
Staff member
The @XXencode and @XXdecode functions are not symmetric in string mode.
It looks like the @XXencode functions are encoding strings as UTF-8, but @@XXdecode are decoding them as the console code page. I think that UTF-8 is the right thing.
(@UUENCODE and @UUDECODE do not support the string mode. @YENCODE / @YDECODE have their own issues, but nobody doesn't care twice as much about them.)
Code:
C:\>ver /r
TCC 31.01.19 x64 Windows 11 [Version 10.0.22621.2861]
TCC Build 19 Windows 11 Build 22621
Registered to COE-LN00074120
C:\>set t=%@b64encode[s,¿Bête noire déjà vu?]
C:\>echo %@b64decode[s,%t]
¿Bête noire déjà vu?
C:\>set t=%@hexencode[s,Crème brûlée €3.50]
C:\>echo %@hexdecode[s,%t]
Crème brûlée €3.50
C:\>set t=%@punyencode[s,fœtal diarrhœa in midiæval Ægypt]
C:\>echo %@punydecode[s,%t]
fœtal diarrhœa in midiæval Ægypt
C:\>set t=%@qpencode[s,¿Bête noire déjà vu?]
C:\>echo %@qpdecode[s,%t]
¿Bête noire déjà vu?
C:\>
It looks like the @XXencode functions are encoding strings as UTF-8, but @@XXdecode are decoding them as the console code page. I think that UTF-8 is the right thing.
(@UUENCODE and @UUDECODE do not support the string mode. @YENCODE / @YDECODE have their own issues, but nobody doesn't care twice as much about them.)