Hi,

There seems to be an inconsistency in the way filenames are handled by APR under Mac OS X.

The function apr_filepath_encoding() returns APR_FILEPATH_ENCODING_LOCALE under UNIX. Under Mac OS X, however, filenames must always be passed to the system calls in UTF-8 format. This creates problems whenever using a locale with something other than UTF-8 as the text encoding (Invalid argument when trying to create files).

Changing the locale setting to UTF-8 is not a good solution, because it also affects the contents of files. For instance, my locale is set to fi_FI.ISO8859-1, allowing me to edit my ISO8859-1 formatted text files properly.

The simplest fix to this would look something like this (file_io/unix/ filepath.c):

APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p)
{
#ifdef DARWIN
    *style = APR_FILEPATH_ENCODING_UTF8;
#else
    *style = APR_FILEPATH_ENCODING_LOCALE;
#endif
    return APR_SUCCESS;
}


I ran across this problem when using Subversion on Mac OS X to check out files with accented letters in their names. After applying the above fix, the checkout worked fine. I believe it would be very helpful for Mac OS X users to have this work 'out-of-the-box'. It would also be correct behaviour, since Mac OS X really uses only UTF-8 filenames in system calls and other encodings are invalid.

Reply via email to