Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Bugs nobody cares about, #2

Charles Dye

Super Moderator
May
5,226
149
Staff member
The @XXencode and @XXdecode functions are not symmetric in string mode.

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.)
 
The @XXencode and @XXdecode functions are not symmetric in string mode.

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.)

The issue with encoding UTF16 strings (crypto library bug) has been fixed for build 20. (Not a code page issue.)

@UUENCODE and @UUDECODE have never supported the string mode (it would be impossible to do that with that data format).

@YENCODE and @YDECODE work with files. Since YEncoding returns multi-line strings with length / crc info before & after the encoding, using the string format for decoding would be nonsensical. They work fine with files (as intended).
 
Back
Top
[FOX] Ultimate Translator
Translate