Welcome!

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

SignUp Now!

@EXECSTR has trouble with Unicode when n < 0

Charles Dye

Super Moderator
May
4,926
126
Staff member
@EXECSTR doesn't appear to recognize UTF-16 output when n < 0 and //UnicodeOutput=No :

Code:
C:\>ver /r

TCC  30.00.22 x64   Windows 10 [Version 10.0.19044.3324]
TCC Build 22   Windows 10 Build 19044
Registered to COE-LN00074120

C:\>type test1.btm
@echo off
for /l %i in ( -10, 1, 10 ) echo %i - %@execstr[%i,babble.exe]

C:\>option //unicodeoutput=yes

C:\>test1.btm
-10 - ABCDE αβγδε АБВГД אבגדה
-9 - ABCDE αβγδε АБВГД אבגדה
-8 - ABCDE αβγδε АБВГД אבגדה
-7 - ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
-6 - ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ αβγδεζηθικλμνξοπρςστυφχψω
-5 - АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ абвгдежзийклмнопрстуфхцчшщъыьэюя
-4 - אבגדהוזחטיךכלםמןנסעףפץצקרשת
-3 - ابةتثجحخدذرزسشصضطظعغ
-2 - ᚠᚡᚢᚣᚤᚥᚦᚧᚨᚩᚪᚫᚬᚭᚮᚯᚰᚱᚲᚳᚴᚵᚶᚷᚸᚹᚺᚻᚼᚽᚾᚿᛀᛁᛂᛃᛄᛅᛆᛇᛈᛉᛊᛋᛌᛍᛎᛏᛐᛑᛒᛓᛔᛕᛖᛗᛘᛙᛚᛛᛜᛝᛞᛟᛠᛡᛢᛣᛤᛥᛦᛧᛨᛩᛪ
-1 -    
0 - ABCDE αβγδε АБВГД אבגדה
1 - ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
2 - ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ αβγδεζηθικλμνξοπρςστυφχψω
3 - АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ абвгдежзийклмнопрстуфхцчшщъыьэюя
4 - אבגדהוזחטיךכלםמןנסעףפץצקרשת
5 - ابةتثجحخدذرزسشصضطظعغ
6 - ᚠᚡᚢᚣᚤᚥᚦᚧᚨᚩᚪᚫᚬᚭᚮᚯᚰᚱᚲᚳᚴᚵᚶᚷᚸᚹᚺᚻᚼᚽᚾᚿᛀᛁᛂᛃᛄᛅᛆᛇᛈᛉᛊᛋᛌᛍᛎᛏᛐᛑᛒᛓᛔᛕᛖᛗᛘᛙᛚᛛᛜᛝᛞᛟᛠᛡᛢᛣᛤᛥᛦᛧᛨᛩᛪ
7 -    
8 -
9 -
10 -

C:\>option //unicodeoutput=no

C:\>test1.btm
-10 - A
-9 - A
-8 -
-7 -
-6 -
-5 -
-4 -
-3 -
-2 -
-1 -
0 - ABCDE αβγδε АБВГД אבגדה
1 - ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
2 - ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ αβγδεζηθικλμνξοπρςστυφχψω
3 - АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ абвгдежзийклмнопрстуфхцчшщъыьэюя
4 - אבגדהוזחטיךכלםמןנסעףפץצקרשת
5 - ابةتثجحخدذرزسشصضطظعغ
6 - ᚠᚡᚢᚣᚤᚥᚦᚧᚨᚩᚪᚫᚬᚭᚮᚯᚰᚱᚲᚳᚴᚵᚶᚷᚸᚹᚺᚻᚼᚽᚾᚿᛀᛁᛂᛃᛄᛅᛆᛇᛈᛉᛊᛋᛌᛍᛎᛏᛐᛑᛒᛓᛔᛕᛖᛗᛘᛙᛚᛛᛜᛝᛞᛟᛠᛡᛢᛣᛤᛥᛦᛧᛨᛩᛪ
7 -    
8 -
9 -
10 -

C:\>
 

Attachments

  • test.zip
    4.2 KB · Views: 82
What @execstr is doing when n < 0 is piping the output of babble.exe to TAIL, and then redirecting the output to a file which @execstr reads.

The problem isn't with @execstr, and it isn't with TAIL. The problem is the output redirection has no way of knowing that you wanted UTF16 output (if you did, you would have asked for it). So like every other default output redirection in TCC, the internal Unicode text is converted to ASCII when it's written to the file.
 
Ah. Well, as I seem to be the only person who's ever noticed it, this one can go on the "nobody cares" pile.
 

Similar threads

Back
Top