From: Nobuyoshi Nakada Date: 2008-11-04T18:48:20+09:00 Subject: Re: Iconv and incompatible encodings Hi, At Tue, 4 Nov 2008 04:04:23 +0900, Davi Barbosa wrote in [ruby-talk:319309]: > require 'gtk2' > ascii = GLib.convert(string, "ASCII//translit", "UTF-8") > > This not only worked for me, as the Iconv started to work as expected! > For instance: > require 'iconv' > require 'gtk2' > puts Iconv.conv("ASCII//translit","UTF-8","бавд") > gives 'aaaa'. GNU libiconv seems to need the locale set. The issue would be fixed by the following patch. Index: configure.in =================================================================== --- configure.in (revision 20103) +++ configure.in (working copy) @@ -559,5 +559,5 @@ AC_CHECK_HEADERS(stdlib.h string.h unist syscall.h pwd.h grp.h a.out.h utime.h memory.h direct.h sys/resource.h \ sys/mkdev.h sys/utime.h netinet/in_systm.h float.h ieeefp.h pthread.h \ - ucontext.h intrinsics.h) + ucontext.h intrinsics.h locale.h) dnl Check additional types. Index: main.c =================================================================== --- main.c (revision 20103) +++ main.c (working copy) @@ -12,4 +12,7 @@ #include "ruby.h" +#ifdef HAVE_LOCALE_H +#include +#endif #ifdef __human68k__ @@ -35,4 +38,7 @@ main(argc, argv) char **argv; { +#ifdef HAVE_LOCALE_H + setlocale(LC_CTYPE, ""); +#endif #ifdef _WIN32 NtInitialize(&argc, &argv); -- Nobu Nakada