Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect display in Solaris encoding 1251 #3992

Closed
mc-butler opened this issue Jun 11, 2019 · 16 comments
Closed

Incorrect display in Solaris encoding 1251 #3992

mc-butler opened this issue Jun 11, 2019 · 16 comments
Assignees
Labels
area: core Issues not related to a specific subsystem prio: low Minor problem or easily worked around
Milestone

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/3992
Reporter shurik005 (shurik005@….com)
Keywords solaris, codepage, ansi1251

Solaris uses the ANSI1251 encoding name than other systems, where CP1251 is usually. As a result, Cyrillic characters are replaced with questions when using this encoding, since mc switches to 7-bit ASCII. When str_8bit_encodings are added to the list of the values "ansi-1251", "ansi1251" in the file lib/strutil/strutil.c, everything displays correctly, but in Options/Display? Bits are also defined by the Input / display codepage 7-bit ASCII, unlike other encodings.

root@test:~# LC_MESSAGES=C mc -F
Home directory: /root
Profile root directory: /root

[System data]
    Config directory: /usr/share/mc/
    Data directory:   /usr/share/mc/
    File extension handlers: /usr/share/mc/ext.d/
    VFS plugins and scripts: /usr/share/mc/
        extfs.d:        /usr/share/mc/extfs.d/
        fish:           /usr/share/mc/fish/

[User data]
    Config directory: /root/.config/mc/
    Data directory:   /root/.local/share/mc/
        skins:          /root/.local/share/mc/skins/
        extfs.d:        /root/.local/share/mc/extfs.d/
        fish:           /root/.local/share/mc/fish/
        mcedit macros:  /root/.local/share/mc/mc.macros
        mcedit external macros: /root/.local/share/mc/mcedit/macros.d/macro.*
    Cache directory:  /root/.cache/mc/
root@test:~# mc --configure-options
 '--prefix=/usr' '--sysconfdir=/usr/share' '--libexec=/usr/share' 'CFLAGS=-m32' 'LDFLAGS=-m32' 'CPPFLAGS=-m32'
@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jun 11, 2019 at 12:27 UTC (comment 1)

Please translate to English.

@mc-butler
Copy link
Author

Changed by shurik005 (shurik005@….com) on Jun 11, 2019 at 12:38 UTC (comment 1.2)

  • Summary changed from Некоррекное отображение в Solaris кодировки 1251 to Incorrect display in Solaris encoding 1251

Replying to andrew_b:

Please translate to English.

Solaris uses the ANSI1251 encoding name than other systems, where CP1251 is usually. As a result, Cyrillic characters are replaced with questions when using this encoding, since mc switches to 7-bit ASCII. When str_8bit_encodings are added to the list of the values "ansi-1251", "ansi1251" in the file lib/strutil/strutil.c, everything displays correctly, but in Options/Display Bits are also defined by the Input / display codepage 7-bit ASCII, unlike other encodings.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jun 11, 2019 at 17:34 UTC (comment 3)

  • Description edited

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jun 11, 2019 at 17:49 UTC (comment 2.4)

Replying to shurik005:

Solaris uses the ANSI1251 encoding name than other systems, where CP1251 is usually. As a result, Cyrillic characters are replaced with questions when using this encoding, since mc switches to 7-bit ASCII. When str_8bit_encodings are added to the list of the values "ansi-1251", "ansi1251" in the file lib/strutil/strutil.c, everything displays correctly, but in Options/Display Bits are also defined by the Input / display codepage 7-bit ASCII, unlike other encodings.

You can add your encoding to mc.charset file. First column is charset name in terms of iconv, second column is display name.

The ANSI1251 charset is unknown for GNU iconv(1):

$ iconv -l | grep 1251
CP1251//
WINDOWS-1251//
$ 

@mc-butler
Copy link
Author

Changed by shurik005 (shurik005@….com) on Jun 13, 2019 at 11:25 UTC (comment 4.5)

Replying to andrew_b:

You can add your encoding to mc.charset file. First column is charset name in terms of iconv, second column is display name.

The ANSI1251 charset is unknown for GNU iconv(1):

$ iconv -l | grep 1251
CP1251//
WINDOWS-1251//
$ 

I'm add encoding and replace CP1251 to ANSI1251 or ANSI-1251, but nothing effect. On Solaris:

root@test:~# iconv -l|grep 1251
    CP1251 (1251, ANSI-1251, WINDOWS-1251, win5),
    wchar_t-ansi-1251,

@mc-butler
Copy link
Author

Changed by shurik005 (shurik005@….com) on Jun 13, 2019 at 11:38 UTC (comment 5.6)

Upps, if compile with added ansi1251,ansi-1251 with change mc.charset then display correctly and Options/Display bits detect fine. Thans

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jul 7, 2019 at 13:25 UTC (comment 7)

  • Milestone changed from Future Releases to 4.8.24
  • Branch state changed from no branch to on review
  • Status changed from new to accepted
  • Owner set to andrew_b

Branch: 3992_solaris_cp1251
[d96fc0923bb576902e50a5a7a1dcf1ef810938bc]

Please test.

@mc-butler
Copy link
Author

Changed by shurik005 (shurik005@….com) on Jul 8, 2019 at 10:39 UTC (comment 7.8)

Replying to andrew_b:

Branch: 3992_solaris_cp1251
[d96fc0923bb576902e50a5a7a1dcf1ef810938bc]

Please test.

Ok, but in mc.chaset need ANSI-1251\tWindows 1251

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jul 8, 2019 at 11:15 UTC (comment 8.9)

Replying to shurik005:

Ok, but in mc.chaset need ANSI-1251\tWindows 1251

This is done in m4.include/mc-i18n.m4:

--- a/m4.include/mc-i18n.m4
+++ b/m4.include/mc-i18n.m4
@@ -23,4 +23,16 @@
         have_charset=yes
         charset_msg="yes"
+
+        dnl Solaris has different name of Windows 1251 encoding
+        case $host_os in
+            solaris*)
+                CP1251="ANSI1251"
+                ;;
+            *)
+                CP1251="CP1251"
+                ;;
+        esac
+
+        AC_SUBST(CP1251)
     fi
 ])

Two clarifications are required:

  • value of $host_os on your OS (you can find it in config.log file)
  • "ANSI1251" or "ANSI-1251" exactly

@mc-butler
Copy link
Author

Changed by shurik005 (shurik005@….com) on Jul 8, 2019 at 11:32 UTC (comment 10)

$grep host_os ./config.log
host_os='solaris2.11'

if "ANSI1251" then working, but in Options/Display? Bits are also defined by the Input / display codepage 7-bit ASCII, unlike other encodings.
if "ANSI-1251" then working all.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jul 8, 2019 at 12:25 UTC (comment 10.11)

Replying to shurik005:

$grep host_os ./config.log
host_os='solaris2.11'

Fine.

if "ANSI1251" then working, but in Options/Display? Bits are also defined by the Input / display codepage 7-bit ASCII, unlike other encodings.
if "ANSI-1251" then working all.

I've added commit to the branch: [2488e9d4ffdd4e681f4c31ac8ecbeec0d8d77eb1]. It will be squashed before merged to master.

@mc-butler
Copy link
Author

Changed by shurik005 (shurik005@….com) on Jul 9, 2019 at 8:45 UTC (comment 12)

Fixed, tested on:

$uname -a
SunOS test 5.11 11.4.6.4.0 sun4v sparc sun4v Solaris

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jul 13, 2019 at 5:53 UTC (comment 13)

  • Branch state changed from on review to approved
  • Votes set to shurik005 andrew_b

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jul 13, 2019 at 5:56 UTC (comment 14)

  • Status changed from accepted to testing
  • Branch state changed from approved to merged
  • Resolution set to fixed
  • Votes changed from shurik005 andrew_b to committed-master

Merged to master: [2dc676e].

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jul 13, 2019 at 5:57 UTC (comment 15)

  • Status changed from testing to closed

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 21, 2019 at 13:56 UTC (comment 16)

Fix is [c4264c5].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues not related to a specific subsystem prio: low Minor problem or easily worked around
Development

No branches or pull requests

2 participants