mirror of https://github.com/MidnightCommander/mc
charset: rename IBM866 to CP866 for iconv and adjust charset names for codeset
``` linux $ iconv -l | grep 866 866// 866NAV// CP866// CP866NAV// CSIBM866// IBM866// IBM866NAV// solaris $ iconv -l | grep 866 CP866 (CP866, CP-866, CP_866, 866), IBM-866, macos % iconv -l | grep 866 CP866 866 CSIBM866 IBM866 MSCP866 musl/src/locale/codepages.h: "cp866\0" ``` On glibc-based systems, codeset will be set to charmap name, on most other systems it seems to be taken from locale name. ## Linux ``` zaytsev@fedora:~$ locale -a | grep ru ru_RU ru_RU.cp866 ru_RU.ibm866 ru_RU.iso88595 ru_RU.koi8r ru_RU.utf8 russian ru_UA ru_UA.koi8u ru_UA.utf8 zaytsev@fedora:~/src$ LC_ALL=ru_RU.cp866 LANG=ru_RU.cp866 ./a.out IBM866 zaytsev@fedora:~/src$ LC_ALL=ru_RU.koi8r LANG=ru_RU.koi8r ./a.out KOI8-R zaytsev@fedora:~/src$ LC_ALL=ru_RU.iso88595 LANG=ru_RU.iso88595 ./a.out ISO-8859-5 ``` ## macOS ``` ru_RU.ISO8859-5 ru_RU.CP866 ru_RU.CP1251 ru_RU.UTF-8 ru_RU.KOI8-R ru_RU zaytsev@Yurys-MBP mc % LANG=ru_RU.CP866 LC_ALL=ru_RU.CP866 ./a.out CP866 zaytsev@Yurys-MBP mc % LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.out ISO8859-5 ``` ## FreeBSD ``` ru_RU.CP1251 ru_RU.CP866 ru_RU.ISO8859-5 ru_RU.KOI8-R ru_RU.UTF-8 zaytsev@cfarm240:~ $ LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.out ISO8859-5 zaytsev@cfarm240:~ $ LANG=ru_RU.CP866 LC_ALL=ru_RU.CP866 ./a.out CP866 ``` ## Solaris ``` ru ru.UTF-8 ru.koi8-r ru_RU ru_RU.ANSI1251 ru_RU.ISO8859-5 ru_RU.KOI8-R ru_RU.UTF-8 zaytsev@gcc-solaris10:~/src$ LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.o> ISO8859-5 zaytsev@gcc-solaris10:~/src$ LANG=ru.koi8-r LC_ALL=ru.koi8-r ./a.out KOI8-R ``` ## AIX ``` zaytsev@gcc111:[/home/zaytsev]locale -a C POSIX en_US.8859-15 en_US.IBM-858 en_US.ISO8859-1 en_US -bash-5.1$ LANG=en_US.ISO8859-1 LC_ALL=en_US.ISO8859-1 ./a.out ISO8859-1 ``` Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
parent
f34e2ae715
commit
1e0e6b5e1e
|
@ -705,6 +705,7 @@ tests/lib/mcconfig/Makefile
|
|||
tests/lib/search/Makefile
|
||||
tests/lib/strutil/Makefile
|
||||
tests/lib/vfs/Makefile
|
||||
tests/lib/vfs/mc.charsets
|
||||
tests/lib/widget/Makefile
|
||||
tests/src/Makefile
|
||||
tests/src/filemanager/Makefile
|
||||
|
|
|
@ -57,18 +57,16 @@ static const char *const str_utf8_encodings[] = {
|
|||
|
||||
/* standard 8bit encodings, no wide or multibytes characters */
|
||||
static const char *const str_8bit_encodings[] = {
|
||||
/* Solaris has different names of Windows 1251 encoding */
|
||||
#ifdef __sun
|
||||
"ansi-1251",
|
||||
"ansi1251",
|
||||
#else
|
||||
"cp-1251",
|
||||
"cp1251",
|
||||
#endif
|
||||
/* solaris */
|
||||
"ansi-1251",
|
||||
"ansi1251",
|
||||
"cp-1250",
|
||||
"cp1250",
|
||||
"cp-866",
|
||||
"cp866",
|
||||
/* glibc */
|
||||
"ibm-866",
|
||||
"ibm866",
|
||||
"cp-850",
|
||||
|
|
|
@ -18,16 +18,27 @@ AC_DEFUN([mc_I18N],[
|
|||
have_charset=yes
|
||||
charset_msg="yes"
|
||||
|
||||
AC_CHECK_HEADERS([gnu/libc-version.h])
|
||||
|
||||
dnl Solaris has different name of Windows 1251 encoding
|
||||
case $host_os in
|
||||
solaris*)
|
||||
CP1251="ANSI-1251"
|
||||
ENCODING_CP1251="ANSI-1251"
|
||||
;;
|
||||
*)
|
||||
CP1251="CP1251"
|
||||
ENCODING_CP1251="CP1251"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(CP1251)
|
||||
if test "x$ac_cv_header_gnu_libc_version_h" != "xno"; then
|
||||
ENCODING_CP866="IBM866"
|
||||
ENCODING_ISO8859="ISO-8859"
|
||||
else
|
||||
ENCODING_CP866="CP866"
|
||||
ENCODING_ISO8859="ISO8859"
|
||||
fi
|
||||
|
||||
AC_SUBST(ENCODING_CP1251)
|
||||
AC_SUBST(ENCODING_CP866)
|
||||
fi
|
||||
])
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
ASCII 7-bit ASCII
|
||||
ISO-8859-1 ISO 8859-1
|
||||
ISO-8859-2 ISO 8859-2
|
||||
ISO-8859-5 ISO 8859-5
|
||||
@ENCODING_ISO8859@-1 ISO 8859-1
|
||||
@ENCODING_ISO8859@-2 ISO 8859-2
|
||||
@ENCODING_ISO8859@-5 ISO 8859-5
|
||||
CP1250 Windows 1250
|
||||
@CP1251@ Windows 1251
|
||||
@ENCODING_CP1251@ Windows 1251
|
||||
CP437 CP 437
|
||||
CP850 CP 850
|
||||
CP852 CP 852
|
||||
IBM866 CP 866
|
||||
@ENCODING_CP866@ CP 866
|
||||
KOI8-R KOI8-R
|
||||
KOI8-U KOI8-U
|
||||
UTF-8 UTF-8
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
PACKAGE_STRING = "/lib/vfs"
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DTEST_SHARE_DIR=\"$(abs_srcdir)\" \
|
||||
-DTEST_SHARE_DIR=\"$(abs_builddir)\" \
|
||||
$(GLIB_CFLAGS) \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/lib/vfs \
|
||||
|
@ -9,7 +9,11 @@ AM_CPPFLAGS = \
|
|||
|
||||
AM_LDFLAGS = @TESTS_LDFLAGS@
|
||||
|
||||
EXTRA_DIST = mc.charsets
|
||||
EXTRA_DIST = mc.charsets.in
|
||||
|
||||
if CHARSET
|
||||
CLEANFILES = mc.charsets
|
||||
endif
|
||||
|
||||
LIBS = @CHECK_LIBS@ \
|
||||
$(top_builddir)/lib/libmc.la
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
ASCII 7-bit ASCII
|
||||
IBM866 CP 866
|
||||
@ENCODING_CP866@ CP 866
|
||||
KOI8-R KOI8-R
|
||||
KOI8-U KOI8-U
|
||||
UTF-8 UTF-8
|
|
@ -48,8 +48,8 @@ setup (void)
|
|||
vfs_init_localfs ();
|
||||
vfs_setup_work_dir ();
|
||||
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
#ifdef HAVE_CHARSET
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
load_codepages_list ();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ setup (void)
|
|||
vfs_init_localfs ();
|
||||
vfs_setup_work_dir ();
|
||||
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
#ifdef HAVE_CHARSET
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
load_codepages_list ();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ setup (void)
|
|||
|
||||
init_test_classes ();
|
||||
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
#ifdef HAVE_CHARSET
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
load_codepages_list ();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -71,8 +71,6 @@ test_init_vfs (const char *encoding)
|
|||
vfs_init_localfs ();
|
||||
vfs_setup_work_dir ();
|
||||
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
load_codepages_list ();
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ setup (void)
|
|||
vfs_init_class (&vfs_test_ops3, "testfs3", VFSF_UNKNOWN, "test3");
|
||||
vfs_register_class (&vfs_test_ops3);
|
||||
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
#ifdef HAVE_CHARSET
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
load_codepages_list ();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -84,8 +84,6 @@ setup (void)
|
|||
vfs_test_ops1->chdir = test_chdir;
|
||||
vfs_register_class (vfs_test_ops1);
|
||||
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
|
||||
vfs_local_ops->chdir = test_chdir;
|
||||
|
||||
test_chdir__init ();
|
||||
|
|
|
@ -112,8 +112,8 @@ static const struct test_vfs_get_encoding_ds
|
|||
NULL
|
||||
},
|
||||
{ /* 14 */
|
||||
"/aaaa/#enc:UTF-8/bbbb/#enc:KOI8-R#enc:IBM866/cccc",
|
||||
"KOI8-R#enc:IBM866"
|
||||
"/aaaa/#enc:UTF-8/bbbb/#enc:KOI8-R#enc:CP866/cccc",
|
||||
"KOI8-R#enc:CP866"
|
||||
}
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
|
|
@ -125,36 +125,36 @@ static const struct test_from_to_string_ds
|
|||
&vfs_test_ops3
|
||||
},
|
||||
{ /* 4. */
|
||||
"/#test1/bla-bla1/#enc:IBM866/some/path/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
|
||||
"/test1://#enc:IBM866/bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
|
||||
"/#test1/bla-bla1/#enc:CP866/some/path/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
|
||||
"/test1://#enc:CP866/bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
|
||||
"111/22/33",
|
||||
4,
|
||||
&vfs_test_ops3
|
||||
},
|
||||
{ /* 5. */
|
||||
"/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:IBM866/#enc:KOI8-R/some/path#test3/111/22/33",
|
||||
"/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:CP866/#enc:KOI8-R/some/path#test3/111/22/33",
|
||||
"/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
|
||||
"111/22/33",
|
||||
4,
|
||||
&vfs_test_ops3
|
||||
},
|
||||
{ /* 6. */
|
||||
"/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:IBM866/some/#enc:KOI8-R/path#test3/111/22/33",
|
||||
"/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:CP866/some/#enc:KOI8-R/path#test3/111/22/33",
|
||||
"/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
|
||||
"111/22/33",
|
||||
4,
|
||||
&vfs_test_ops3
|
||||
},
|
||||
{ /* 7. */
|
||||
"/#test1/bla-bla1/some/path/#test2/#enc:IBM866/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
|
||||
"/#test1/bla-bla1/some/path/#test2/#enc:CP866/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
|
||||
"/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
|
||||
"111/22/33",
|
||||
4,
|
||||
&vfs_test_ops3
|
||||
},
|
||||
{ /* 8. */
|
||||
"/#test1/bla-bla1/some/path/#enc:IBM866/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
|
||||
"/test1://#enc:IBM866/bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
|
||||
"/#test1/bla-bla1/some/path/#enc:CP866/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
|
||||
"/test1://#enc:CP866/bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
|
||||
"111/22/33",
|
||||
4,
|
||||
&vfs_test_ops3
|
||||
|
|
Loading…
Reference in New Issue