apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko Čibej <br...@xbc.nu>
Subject Re: Is --enable-utf8 working everywhere?
Date Wed, 17 Jul 2002 03:57:53 GMT
Karl Fogel wrote:

>Branko Čibej <brane@xbc.nu> writes:
>>Karl, about the file name conversions in Subversion: remember what I
>>said about APR using UTF-8 file names directly on some platforms?
>>Well, the conversions in SVN should probably be coded like this:
>Yeah, remember that.  But does the platform-specific conditional code
>have to go in Subversion?  I understand that APR rightly shouldn't do
>any conversion here, since the output would be the same as the input,
>but perhaps APR could somehow signal this fact back?  (The fact that
>no conversion is necessary, that is).  After all, it is our
>portability layer... Then Subversion, on receiving this signal, could
>simply dup the input in the right pool and return it, without having
>any platform-specific tests in its own code.

We'd have to add some kind of predicate into APR that lets us check for 
that. Something like this, implemented in the platform-specific filepath.c:

APR_DECLARE(int) apr_filepath_is_utf8 (void);

The Unix implementation (and probably most others) would just return 0. 
On Windows, it would be

APR_DECLARE(int) apr_filepath_is_utf8 (void)
        return 1;
        return 0;

and the conversions would become, e.g.,

    char *utf8_filename = (something);
    char *native_filename;
    if (apr_filepath_is_utf8())
       native_filename = apr_pstrdup(pool, utf8_filename);
      native_filename = convert_utf8_to_locale_charset(utf8_filename);

>(Btw we *do* have to dup into the right pool, can't just assign back,
>as Marcus and I learned the hard way :-) ).

Bang? Crash? Clobber, even? :-)

BTW; I just noticed that the apr_filepath_* functions on Windows can 
potentially fail horribly if the paths are not UTF-8 (so, not 
IF_WIN_OS_IS_UNICODE) and the locale uses Shift-JIS, because '\' can be 
the second byte in a SJIS doublebyte char. Talk about fun.

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

View raw message