Date: Fri, 08 Mar 2002 23:41:06 +0900 From: SASAKI Katuhiro <sahiro@crest.ocn.ne.jp> To: gnome@FreeBSD.org Cc: ports@FreeBSD.org Subject: The libcharset library does not know some locales. Message-ID: <3c88cd22.6664%sahiro@crest.ocn.ne.jp>
next in thread | raw e-mail | index | archive | help
Hi. I found that locale_charset() function in libcharset library (which is provided by converters/libiconv) does not know "ja_JP.eucJP", "ko_KR.eucKR" and "zh_CN.eucCN". I attach a small code for test and a patch. To confirm this problem, please compile below code with -lcharset and run it under latest 4.5-STABLE. If locale_charset() knows ja_JP.eucJP", this small program must return "EUC-JP". But it will return "ja_JP.eucJP". This result is bad. libcharsettest.c: #include <stdio.h> #include <stdlib.h> #include <locale.h> #include <libcharset.h> int main() { char* encoding; setenv("LANG", "ja_JP.eucJP", 1); setlocale(LC_CTYPE, ""); encoding = locale_charset(); if (encoding) { printf("%s%s\n", "return value is ", encoding); } else { printf("%s\n", "return value is null"); } return 0; } Applying a patch to below the skeleton of converters/libiconv will fix this problem, I think. Please test and review. Thank you for reading this message. diff -urN /usr/ports/converters/libiconv/files/patch-ae libiconv/files/patch-ae --- /usr/ports/converters/libiconv/files/patch-ae Mon Aug 27 23:11:27 2001 +++ libiconv/files/patch-ae Thu Feb 28 22:17:23 2002 @@ -1,8 +1,8 @@ $FreeBSD: ports/converters/libiconv/files/patch-ae,v 1.4 2001/08/27 09:39:53 sobomax Exp $ ---- libcharset/lib/Makefile.in.orig Thu Jun 28 01:56:56 2001 -+++ libcharset/lib/Makefile.in Mon Aug 27 12:32:43 2001 +--- libcharset/lib/Makefile.in.orig Thu Jun 28 07:56:56 2001 ++++ libcharset/lib/Makefile.in Thu Feb 28 21:58:05 2002 @@ -10,6 +10,7 @@ local_prefix = /usr/local exec_prefix = @exec_prefix@ @@ -29,24 +29,24 @@ charset.alias: $(srcdir)/config.charset $(SHELL) $(srcdir)/config.charset '@host@' > t-$@ -@@ -72,11 +73,12 @@ +@@ -72,11 +73,11 @@ install-lib : all force $(MKINSTALLDIRS) $(libdir) $(LIBTOOL_INSTALL) $(INSTALL_DATA) libcharset.la $(libdir)/libcharset.la - test -f $(libdir)/charset.alias && orig=$(libdir)/charset.alias \ -+ $(MKINSTALLDIRS) $(sysconfdir) -+ test -f $(sysconfdir)/charset.alias && orig=$(sysconfdir)/charset.alias \ - || orig=charset.alias; \ +- || orig=charset.alias; \ - sed -f ref-add.sed $$orig > $(libdir)/t-charset.alias; \ - $(INSTALL_DATA) $(libdir)/t-charset.alias $(libdir)/charset.alias; \ - rm -f $(libdir)/t-charset.alias ++ $(MKINSTALLDIRS) $(sysconfdir) ++ orig=charset.alias; \ + sed -f ref-add.sed $$orig > $(sysconfdir)/t-charset.alias; \ + $(INSTALL_DATA) $(sysconfdir)/t-charset.alias $(sysconfdir)/charset.alias; \ + rm -f $(sysconfdir)/t-charset.alias # The following is needed in order to install a simple file in $(libdir) # which is shared with other installed packages. We use a list of referencing -@@ -88,15 +90,16 @@ +@@ -88,16 +89,11 @@ install : all force $(MKINSTALLDIRS) $(DESTDIR)$(libdir) $(LIBTOOL_INSTALL) $(INSTALL_DATA) libcharset.la $(DESTDIR)$(libdir)/libcharset.la @@ -54,19 +54,17 @@ - sed -f ref-add.sed $(DESTDIR)$(libdir)/charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \ - $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \ - rm -f $(DESTDIR)$(libdir)/t-charset.alias; \ -+ $(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir) -+ if test -f $(DESTDIR)$(sysconfdir)/charset.alias; then \ -+ sed -f ref-add.sed $(DESTDIR)$(sysconfdir)/charset.alias > $(DESTDIR)$(sysconfdir)/t-charset.alias; \ -+ $(INSTALL_DATA) $(DESTDIR)$(sysconfdir)/t-charset.alias $(DESTDIR)$(sysconfdir)/charset.alias; \ -+ rm -f $(DESTDIR)$(sysconfdir)/t-charset.alias; \ - else \ - if test @GLIBC21@ = no; then \ +- else \ +- if test @GLIBC21@ = no; then \ - sed -f ref-add.sed charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \ - $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \ - rm -f $(DESTDIR)$(libdir)/t-charset.alias; \ -+ sed -f ref-add.sed charset.alias > $(DESTDIR)$(sysconfdir)/t-charset.alias; \ -+ $(INSTALL_DATA) $(DESTDIR)$(sysconfdir)/t-charset.alias $(DESTDIR)$(sysconfdir)/charset.alias; \ -+ rm -f $(DESTDIR)$(sysconfdir)/t-charset.alias; \ - fi ; \ +- fi ; \ ++ $(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir) ++ if test @GLIBC21@ = no; then \ ++ sed -f ref-add.sed charset.alias > $(DESTDIR)$(sysconfdir)/t-charset.alias; \ ++ $(INSTALL_DATA) $(DESTDIR)$(sysconfdir)/t-charset.alias $(DESTDIR)$(sysconfdir)/charset.alias; \ ++ rm -f $(DESTDIR)$(sysconfdir)/t-charset.alias; \ fi + installdirs : force diff -urN /usr/ports/converters/libiconv/files/patch-libcharset::lib::config.charset libiconv/files/patch-libcharset::lib::config.charset --- /usr/ports/converters/libiconv/files/patch-libcharset::lib::config.charset Thu Jan 1 09:00:00 1970 +++ libiconv/files/patch-libcharset::lib::config.charset Thu Feb 28 22:18:48 2002 @@ -0,0 +1,18 @@ +$FreeBSD$ + +--- libcharset/lib/config.charset.orig Mon Jun 25 21:01:22 2001 ++++ libcharset/lib/config.charset Thu Feb 28 21:27:15 2002 +@@ -264,10 +264,13 @@ + echo "uk_UA.KOI8-U KOI8-U" + echo "zh_TW.BIG5 BIG5" + echo "zh_TW.Big5 BIG5" ++ echo "zh_CN.eucCN GB2312" + echo "zh_CN.EUC GB2312" ++ echo "ja_JP.eucJP EUC-JP" + echo "ja_JP.EUC EUC-JP" + echo "ja_JP.SJIS SHIFT_JIS" + echo "ja_JP.Shift_JIS SHIFT_JIS" ++ echo "ko_KR.eucKR EUC-KR" + echo "ko_KR.EUC EUC-KR" + ;; + beos*) -- SASAKI Katuhiro mailto: sahiro@crest.ocn.ne.jp To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-gnome" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3c88cd22.6664%sahiro>