[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Alpha on Win32 without UTF8 conversion

From: Branko Čibej <brane_at_xbc.nu>
Date: 2002-07-23 04:12:50 CEST

cmpilato@collab.net wrote:

>Brane, if you can (pleeeeease) take the time to summarize briefly the
>problems you know of, and a checklist of whether or not you've got
>solutions for those problems (perhaps pending in mailing list
>archives), I'd be glad to take a stab at picking up where you left
>off.
>
>

O.K., here's a summary:

    * Paths in APR:
          o We must have a way to find out what encoding the file names
            produced and consumed by APR have, because on WinNT, those
            will always be in UTF-8, regardless of the current locale
            settings. See my message and resulting thread in dev@apr:

Subject: [PATCH] Determining the character encoding used for paths in APR

    * Determining the default locale encoding:
          o apr_xlate.h defines APR_LOCALE_CHARSET, which you can pass
            to apr_xlate_open to have it figure out the encoding used by
            the current locale. The implementation is unix-only. I wrote
            a patch for Windows; I'm attaching the relevant bits of that
            patch.
          o Now that apr_xlate is in apr-util, that patch has to be
            broken out and the code moved into APR. I suggested two new
            functions, apr_os_locale_encoding and
            apr_os_default_encoding, that would replace the
            get_locale_charset and get_default_charset in xlate.c.
    * Getting a working iconv library
          o apr-iconv isn't.
          o I still think supporting GNU libiconv is the way to go. See
            my mail in dev@subversion:

Subject: Re: Is --enable-utf8 working everywhere?
Message-ID: <3D34CD49.2070403@xbc.nu>
      

            Either the solition that detects and builds the libiconv
            sources, or one that detects and links with a pre-compiled
            libiconv, would be fine. Note that we wouldn't distribute
            any LGPL code, nor make libiconv binaries available -- just
            tell users how to build them. For the win32 binaries on the
            sownload site, it'd be quite enought to add a link to the
            gnu site where the sources are available; it's not as if
            we're changing that source.

Please ask if any of this isn't clear.

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/

Index: i18n/unix/xlate.c
===================================================================
RCS file: /home/cvs/apr/i18n/unix/xlate.c,v
retrieving revision 1.28
diff -u -p -r1.28 xlate.c
--- i18n/unix/xlate.c 15 Jul 2002 19:21:01 -0000 1.28
+++ i18n/unix/xlate.c 17 Jul 2002 00:46:12 -0000
@@ -146,9 +146,21 @@ static const char *get_default_charset(v
  * defer to get_default_charset().
  */
 
-static const char *get_locale_charset(void)
+static const char *get_locale_charset(apr_pool_t *pool)
 {
-#if defined(HAVE_NL_LANGINFO) && defined(HAVE_CODESET)
+#ifdef WIN32
+ /* ### Yes, this is a hack and doesn't belong in this file.
+ Will fix soonest. --brane */
+ LCID locale = GetThreadLocale();
+ int len = GetLocaleInfo(locale, LOCALE_IDEFAULTANSICODEPAGE, NULL, 0);
+ char *cp = apr_palloc(pool, len + 2);
+ if (0 < GetLocaleInfo(locale, LOCALE_IDEFAULTANSICODEPAGE, cp + 2, len))
+ {
+ cp[0] = 'C';
+ cp[1] = 'P';
+ return cp;
+ }
+#elif defined(HAVE_NL_LANGINFO) && defined(HAVE_CODESET)
     const char *charset;
     charset = nl_langinfo(CODESET);
     if (charset) {
@@ -158,13 +170,13 @@ static const char *get_locale_charset(vo
     return get_default_charset();
 }
 
-static const char *handle_special_names(const char *page)
+static const char *handle_special_names(const char *page, apr_pool_t *pool)
 {
     if (page == APR_DEFAULT_CHARSET) {
         return get_default_charset();
     }
     else if (page == APR_LOCALE_CHARSET) {
- return get_locale_charset();
+ return get_locale_charset(pool);
     }
     else {
         return page;
@@ -236,8 +250,8 @@ apr_status_t apr_xlate_open(apr_xlate_t
 
     *convset = NULL;
 
- topage = handle_special_names(topage);
- frompage = handle_special_names(frompage);
+ topage = handle_special_names(topage, pool);
+ frompage = handle_special_names(frompage, pool);
     
     new = (apr_xlate_t *)apr_pcalloc(pool, sizeof(apr_xlate_t));
     if (!new) {

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jul 23 04:13:22 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.