Currently trunk is very broken wrt the return value of *gettext() calls and
the assumption that Subversion uses UTF-8 internally.
Instead of disabling NLS entirely until the matter has been settled (which
was my first reaction), I propose a path to a solution in two steps:
1) Committing the patch below which disables NLS only if it can't be
instructed to return UTF-8 encoded strings (bind_textdomain_codeset not
available);
This condition means that all non-gnu gettext implementations are affected,
with the exception of Solaris gettext in Solaris 8 (starting at a certain
patch level) and Solaris 9.
2) Write proxy functions for the *gettext() calls in a newly created
svn_gtxt_* namespace which convert return values from the current locale to
UTF-8 (probably added to libsvn_subr); the gettext calls can be routed to
these functions if the conditions of (1) are not met.
When _() and *gettext() return utf-8 all data passed to 'the outside world'
(printf and others) will have to be translated to the active charset;
svn_cmdline_cstring_from_utf8_fuzzy should do that.
This patch has been verified to work on my system; which is hardly
surprising since it is an english gnu linux system with UTF-8 locale...
Log:
[[[
Fix UTF-8 & gettext brokenness
* configure.in (ENABLE_NLS): disable NLS (for now) if there is no
   way to assure UTF-8 output
* svn_private_config.hw: define HAVE_BIND_TEXTDOMAIN_CODESET assuming
   to be building against GNU gettext
* subversion/libsvn_subr/cmdline.c (svn_cmdline_init): tell gettext to
   return UTF-8 data for the Subversion domain
]]]
Index: configure.in
===================================================================
--- configure.in        (revision 9587)
+++ configure.in        (working copy)
@@ -282,6 +282,18 @@
                     AC_MSG_WARN([bindtextdomain() not found.  Disabling
NLS.])
                     enable_nls="no"
                    ])
+      AC_SEARCH_LIBS(bind_textdomain_codeset, [intl],
+                     [
+                       AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET, 1,
+                                 [Define to 1 if bind_textdomain_codeset
+                                  is available for setting gettext output
+                                  encoding])
+                     ],
+                     [
+                       AC_MSG_WARN([bind_textdomain_codeset() not found.
+                                    Disabling NLS.])
+                       enable_nls="no"
+                     ])
     if test "$enable_nls" = "yes"; then
       AC_DEFINE(ENABLE_NLS, 1,
                 [Define to 1 if translation of program messages to the
user's
Index: subversion/libsvn_subr/cmdline.c
===================================================================
--- subversion/libsvn_subr/cmdline.c    (revision 9587)
+++ subversion/libsvn_subr/cmdline.c    (working copy)
@@ -164,11 +164,16 @@
     apr_pool_destroy (pool);
   }
 #else
-  bindtextdomain(PACKAGE_NAME, SVN_LOCALE_DIR);
+  bindtextdomain (PACKAGE_NAME, SVN_LOCALE_DIR);
+#endif /* WIN32 */
+
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+  bind_textdomain_codeset (PACKAGE_NAME, "UTF-8");
 #endif
-  textdomain(PACKAGE_NAME);
-#endif
  
+  textdomain (PACKAGE_NAME);
+#endif /* ENABLE_NLS */
+
   return EXIT_SUCCESS;
 }
  
Index: svn_private_config.hw
===================================================================
--- svn_private_config.hw       (revision 9587)
+++ svn_private_config.hw       (working copy)
@@ -59,6 +59,10 @@
 #define PACKAGE_NAME "subversion"
  
 #ifdef ENABLE_NLS
+
+/* assume building against gnu gettext variant */
+#define HAVE_BIND_TEXTDOMAIN_CODESET 1
+
 #define SVN_LOCALE_RELATIVE_PATH "../share/locale"
 #include <locale.h>
 #include <libintl.h>
-- 
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat May  1 12:25:57 2004