RUNRET Cyrillic encoding problems

Things you’d like to miss in the future...
Post Reply
medder
Posts: 69
Joined: 19 May 2008 02:55

RUNRET Cyrillic encoding problems

Post by medder »

v20.50.0112

I've tried the text runret("net view"); example from beta thread (Thanks for that by the way, the delay in handing unavailable network locations (symlinks) is much shorter now. Much appreciated.).

And I was surprised to see the half of Cyrillic symbols displayed as "?" (while the other half displayed correctly).

ECHO and TEXT have the same problem.

::text runret("net view")

XYplorer -> RUNRET("NET VIEW")
XYplorer -> RUNRET("NET VIEW")
screen-191105-001447.png (5.72 KiB) Viewed 6168 times

The original text should be:
CMD.EXE -> NET VIEW
CMD.EXE -> NET VIEW
screen-191105-002107.png (9.22 KiB) Viewed 6168 times

The message is notifying me that some of my SMB-shares is using SMB1 protocol (old and unsafe).

The first line should be:
Системная ошибка 384.
XYplorer displays:
С????мна? о????а 384

The default Windows codepage for console is 866 (CP866, OEM Russian, Cyrillic DOS)
I've tried different encoding combinations. No luck.

Code: Select all

text runret("net view");
text runret("net view", , 866);
text runret("cmd /c chcp 866 & cmd /c net view", , 866);
Other windows console commands (like DIR) have the same output (some Russian letters are displayed correctly, some are "?")

___________________________________________

So I made two sample folders named with Russian alphabet in lowercase and in uppercase.
1_абвгдеёжзийклмнопрстуфхцчшщъыьэюя
2_АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ



Here's how the output should look like (for some reason when switching from 866 to Unicode
Windows switches from Russian to English text):
Windows Command Prompt
Windows Command Prompt
screen-191105-005429.png (19.56 KiB) Viewed 6168 times

Here's the output in XYplorer

Code: Select all

text runret("cmd /c DIR C:\TEST");
text runret("cmd /c chcp 866 & cmd /c DIR C:\TEST", , 866);
text runret("cmd /c chcp 65001 & cmd /c DIR C:\TEST", , 65001);
default
default
screen-191105-011103.png (11.45 KiB) Viewed 6168 times
866
866
screen-191105-011027.png (11.98 KiB) Viewed 6168 times
65001
65001
screen-191105-010941.png (12.93 KiB) Viewed 6168 times
Windows 1251 (traditional Windows Cyrillic encoding) gives "?" for every Cyrillic letter.

XYplorer is using the Windows default font Consolas (Courier New looks the same).
XYplorer Font dialog has some drop-down field for switching between Western/Cyrillic/etc (but this setting is not saved on OK).

No other XYplorer scripting command has any problems with Russian letters. Everything looks good except RUNRET.
XYplorer INI font settings:

Code: Select all

[Font]
Name=Segoe UI
MilliSize=8250
Bold=0
Italic=0
InterfaceFont=Segoe UI
InterfaceFontMilliSize=8250
MonospaceFont=Consolas
MonospaceFontMilliSize=11250
EditorFont=Consolas
EditorFontMilliSize=11250
ToolbarFont=Segoe UI
ToolbarFontMilliSize=8250
ApplyFontMain=31

Windows Command Prompt (CMD) Settings default (and current) encoding: 866 OEM Russian
CMD
CMD
screen-191105-014523.png (1.54 KiB) Viewed 6161 times
XYplorer Various Information:
System Locale ID: 1049 (ru-RU)
Thread Locale ID: 3072 (ru-UA)
Default ANSI Code Page: 1251 (ANSI - кириллица)
Active ANSI Code Page: 1251 (ANSI - кириллица)
Default OEM code page: 866 (OEM - русская)
Active OEM Code Page: 866 (OEM - русская)
Is DBCS Code Page: No
Main Contents Font: Segoe UI 8,25


No other Windows (or third-party) application has encoding problems.



Am I doing something wrong? Or there's some bug?

admin
Site Admin
Posts: 64325
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: RUNRET Cyrillic encoding problems

Post by admin »

Both calls work fine here with the cyrillic files:

Code: Select all

text runret("cmd /c chcp 866 & cmd /c DIR C:\TEST", , 866);
text runret("cmd /c chcp 65001 & cmd /c DIR C:\TEST", , 65001);
The only difference:
System Locale ID: 1031 (de-DE)
Thread Locale ID: 1031 (de-DE)
Default ANSI Code Page: 1252 (ANSI - Lateinisch I)
Active ANSI Code Page: 1252 (ANSI - Lateinisch I)
Default OEM code page: 850 (OEM - Multilingual Lateinisch I)
Active OEM Code Page: 850 (OEM - Multilingual Lateinisch I)
Is DBCS Code Page: No
Main Contents Font: Segoe UI 9

I will later switch to Russian locale to see what happens then...
FAQ | XY News RSS | XY X - Forum users with the Windows version and screen scaling percentage in the Location field of their profiles get priority support.

admin
Site Admin
Posts: 64325
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: RUNRET Cyrillic encoding problems

Post by admin »

Ok, now I'm here:
System Locale ID: 1049 (ru-RU)
Thread Locale ID: 1031 (de-DE)
Default ANSI Code Page: 1252 (ANSI - Lateinisch I)
Active ANSI Code Page: 1251 (ANSI - Kyrillisch)
Default OEM code page: 850 (OEM - Multilingual Lateinisch I)
Active OEM Code Page: 866 (OEM - Russisch)
Is DBCS Code Page: No
Main Contents Font: Segoe UI 9


And it works out of the box using text runret("cmd /c DIR"); (when I'm in that folder):
RunRetCyrillic1.png
RunRetCyrillic1.png (14.26 KiB) Viewed 6132 times
And I get the same result using this:
text runret("cmd /c chcp 866 & cmd /c DIR", , 866);
or this:
text runret("cmd /c chcp 65001 & cmd /c DIR", , 65001);
FAQ | XY News RSS | XY X - Forum users with the Windows version and screen scaling percentage in the Location field of their profiles get priority support.

medder
Posts: 69
Joined: 19 May 2008 02:55

Re: RUNRET Cyrillic encoding problems

Post by medder »

Well... I've got no ideas...

I've downloaded a new copy of XYplorer (No-Install ZIP), here's what I get with the default settings.

Code (with labels for easy reading):

Code: Select all

text
 'listfolder("C:\TEST",,,"<crlf>")' .<crlf>. listfolder("C:\TEST",,,"<crlf>") .<crlf>.<crlf>.
 'folderreport(, "r", "C:\TEST")' .<crlf>. folderreport("dirs", "r", "C:\TEST") .<crlf>.
 'runret("cmd /c DIR /B", "C:\TEST")' .<crlf>. runret("cmd /c DIR /B", "C:\TEST") .<crlf>.
 'runret("cmd /c CHCP 866 & cmd /c DIR /B", "C:\TEST", 866)' .<crlf>. runret("cmd /c CHCP 866 & cmd /c DIR /B", "C:\TEST", 866) .<crlf>.
 'runret("cmd /c CHCP 65001 & cmd /c DIR /B", "C:\TEST", 65001)' .<crlf>. runret("cmd /c CHCP 65001 & cmd /c DIR /B", "C:\TEST", 65001);
Result:

Code: Select all

listfolder("C:\TEST",,,"<crlf>")
C:\TEST\1_абвгдеёжзийклмнопрстуфхцчшщъыьэюя
C:\TEST\2_АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ

folderreport(, "r", "C:\TEST")
C:\TEST\1_абвгдеёжзийклмнопрстуфхцчшщъыьэюя
C:\TEST\2_АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ

runret("cmd /c DIR /B", "C:\TEST")
1_а???д??жз?й?лмно?????????????????
2_??В?ДЕ?ЖЗАЙ?Л?????СТУФХЦЧ?Щ?Ы????

runret("cmd /c CHCP 866 & cmd /c DIR /B", "C:\TEST", 866)
Т????а? ?одо?а? ???ан??а: 866
1_а???д??жз?й?лмно?????????????????
2_??В?ДЕ?ЖЗАЙ?Л?????СТУФХЦЧ?Щ?Ы????

runret("cmd /c CHCP 65001 & cmd /c DIR /B", "C:\TEST", 65001)
Active code page: 65001
1_?�?�???????�?�?�?�???????�?????????????�???�?�?�?�?�?�???�????????
2_???�?�?�?�?�???�?�???�???�?????????�???????�???�?�???�???�?�?�?�??
Screenshot:
RUNRET
RUNRET
screen-191107-021545.png (22.83 KiB) Viewed 6116 times

XYplorer has no problems with LISTFOLDER and FOLDERREPORT.
But when using RUNRET, some Russian symbols are messed up, while other symbols are displayed correctly.

medder
Posts: 69
Joined: 19 May 2008 02:55

Re: RUNRET Cyrillic encoding problems

Post by medder »

Here is a HEX DUMP if that can somehow help:

Windows command prompt:

Code: Select all

C:\TEST>CHCP 866
Текущая кодовая страница: 866

C:\TEST>DIR /B
1_абвгдеёжзийклмнопрстуфхцчшщъыьэюя
2_АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
XYplorer's RUNRET
text runret("cmd /c CHCP 866 & cmd /c DIR /B", "C:\TEST", 866);

Code: Select all

1_а???д??жз?й?лмно?????????????????
2_??В?ДЕ?ЖЗАЙ?Л?????СТУФХЦЧ?Щ?Ы????
HEX-DUMP
text runret("cmd /c CHCP 866 & cmd /c DIR /B", "C:\TEST", 866, 1);

Code: Select all

00000000: 92 A5 AA E3 E9 A0 EF 20 AA AE A4 AE A2 A0 EF 20   ’¥ªãé ï ª®¤®¢ ï 
00000010: E1 E2 E0 A0 AD A8 E6 A0 3A 20 38 36 36 0D 0A 00   áâà ­¨æ : 866...
00000020: 31 5F A0 A1 A2 A3 A4 A5 F1 A6 A7 A8 A9 AA AB AC   1_ ¡¢£¤¥ñ¦§¨©ª«¬
00000030: AD AE AF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC   ­®¯àáâãäåæçèéêëì
00000040: ED EE EF 00 0D 0A A0 A1 A2 A3 A4 A5 F1 A6 A7 A8   íîï... ¡¢£¤¥ñ¦§¨
00000050: A9 AA AB AC AD AE AF E0 E1 E2 E3 E4 E5 E6 E7 E8   ©ª«¬­®¯àáâãäåæçè
00000060: E9 EA EB EC ED EE EF 00 32 5F 80 81 82 83 84 85   éêëìíîï.2_€‚ƒ„…
00000070: F0 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94   ð†‡ˆ‰Š‹ŒŽ‘’“”
00000080: 95 96 97 98 99 9A 9B 9C 9D 9E 9F 00 0D 0A 80 81   •–—˜™š›œžŸ...€
00000090: 82 83 84 85 F0 86 87 88 89 8A 8B 8C 8D 8E 8F 90   ‚ƒ„…ð†‡ˆ‰Š‹ŒŽ
000000a0: 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F 00   ‘’“”•–—˜™š›œžŸ.



And the other one (without specifying the codepage):
::text runret("cmd /c DIR /B", "C:\TEST", , 1);

Code: Select all

00000000: 31 5F A0 A1 A2 A3 A4 A5 F1 A6 A7 A8 A9 AA AB AC   1_ ¡¢£¤¥ñ¦§¨©ª«¬
00000010: AD AE AF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC   ­®¯àáâãäåæçèéêëì
00000020: ED EE EF 00 0D 0A A0 A1 A2 A3 A4 A5 F1 A6 A7 A8   íîï... ¡¢£¤¥ñ¦§¨
00000030: A9 AA AB AC AD AE AF E0 E1 E2 E3 E4 E5 E6 E7 E8   ©ª«¬­®¯àáâãäåæçè
00000040: E9 EA EB EC ED EE EF 00 32 5F 80 81 82 83 84 85   éêëìíîï.2_€‚ƒ„…
00000050: F0 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94   ð†‡ˆ‰Š‹ŒŽ‘’“”
00000060: 95 96 97 98 99 9A 9B 9C 9D 9E 9F 00 0D 0A 80 81   •–—˜™š›œžŸ...€
00000070: 82 83 84 85 F0 86 87 88 89 8A 8B 8C 8D 8E 8F 90   ‚ƒ„…ð†‡ˆ‰Š‹ŒŽ
00000080: 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F 00   ‘’“”•–—˜™š›œžŸ.

admin
Site Admin
Posts: 64325
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: RUNRET Cyrillic encoding problems

Post by admin »

Tricky. I'll try something in the next beta...
FAQ | XY News RSS | XY X - Forum users with the Windows version and screen scaling percentage in the Location field of their profiles get priority support.

medder
Posts: 69
Joined: 19 May 2008 02:55

Re: RUNRET Cyrillic encoding problems

Post by medder »

The fix helped. Thank you.

Sample:

Code: Select all

1_абвгдеёжзийклмнопрстуфхцчшщъыьэюя
2_АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
Script:

Code: Select all

text
 'XYplorer ' . property("fileversion", "<xypath>\<xyexe>").<crlf>.<crlf>.
 'listfolder("C:\TEST",,4,"<crlf>")' .<crlf>. listfolder("C:\TEST",,4,"<crlf>") .<crlf>.<crlf>.
 'folderreport("dirsrel", "r", "C:\TEST")' .<crlf>. folderreport("dirsrel", "r", "C:\TEST") .<crlf>.
 'runret("cmd /c DIR /B", "C:\TEST")' .<crlf>. runret("cmd /c DIR /B", "C:\TEST") .<crlf>.
 'runret("cmd /c CHCP 866 & cmd /c DIR /B", "C:\TEST", 866)' .<crlf>. runret("cmd /c CHCP 866 & cmd /c DIR /B", "C:\TEST", 866) .<crlf>.
 'runret("cmd /c CHCP 65001 & cmd /c DIR /B", "C:\TEST", 65001)' .<crlf>. runret("cmd /c CHCP 65001 & cmd /c DIR /B", "C:\TEST", 65001);

BEFORE:
screen-191107-134751.png
screen-191107-134751.png (21.55 KiB) Viewed 5986 times

AFTER:
screen-191107-134843.png
screen-191107-134843.png (27.13 KiB) Viewed 5986 times

admin
Site Admin
Posts: 64325
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: RUNRET Cyrillic encoding problems

Post by admin »

Wow. :biggrin:
FAQ | XY News RSS | XY X - Forum users with the Windows version and screen scaling percentage in the Location field of their profiles get priority support.

Post Reply