diff -Naur subversion-1.7.4/subversion/include/svn_utf.h subversion-1.7.4-r1/subversion/include/svn_utf.h --- subversion-1.7.4/subversion/include/svn_utf.h 2009-11-16 20:07:17.000000000 +0100 +++ subversion-1.7.4-r1/subversion/include/svn_utf.h 2012-05-03 00:43:54.773643346 +0200 @@ -49,14 +49,29 @@ * Initialize the UTF-8 encoding/decoding routines. * Allocate cached translation handles in a subpool of @a pool. * + * If @a assume_native_utf8 is TRUE, the native character set is + * assumed to be UTF-8, i.e. conversion is a no-op. This is useful + * in contexts where the native character set is ASCII but UTF-8 + * should be used regardless (e.g. for mod_dav_svn which runs within + * httpd and always uses the "C" locale). + * * @note It is optional to call this function, but if it is used, no other * svn function may be in use in other threads during the call of this * function or when @a pool is cleared or destroyed. * Initializing the UTF-8 routines will improve performance. * - * @since New in 1.1. + * @since New in 1.8. */ void +svn_utf_initialize2(apr_pool_t *pool, + svn_boolean_t assume_native_utf8); +/** +* Like svn_utf_initialize but without the ability to force the +* native encoding to UTF-8. +* +* @deprecated Provided with backwards compatibility with the 1.7 API. +*/ +void svn_utf_initialize(apr_pool_t *pool); /** Set @a *dest to a utf8-encoded stringbuf from native stringbuf @a src; diff -Naur subversion-1.7.4/subversion/libsvn_subr/cmdline.c subversion-1.7.4-r1/subversion/libsvn_subr/cmdline.c --- subversion-1.7.4/subversion/libsvn_subr/cmdline.c 2011-06-07 16:45:59.000000000 +0200 +++ subversion-1.7.4-r1/subversion/libsvn_subr/cmdline.c 2012-05-03 00:45:57.239235322 +0200 @@ -220,7 +220,7 @@ /* Create a pool for use by the UTF-8 routines. It will be cleaned up by APR at exit time. */ pool = svn_pool_create(NULL); - svn_utf_initialize(pool); + svn_utf_initialize2(pool, FALSE); if ((err = svn_nls_init())) { diff -Naur subversion-1.7.4/subversion/libsvn_subr/deprecated.c subversion-1.7.4-r1/subversion/libsvn_subr/deprecated.c --- subversion-1.7.4/subversion/libsvn_subr/deprecated.c 2011-06-28 13:54:55.000000000 +0200 +++ subversion-1.7.4-r1/subversion/libsvn_subr/deprecated.c 2012-05-03 00:44:59.702487421 +0200 @@ -39,6 +39,7 @@ #include "svn_pools.h" #include "svn_dso.h" #include "svn_mergeinfo.h" +#include "svn_utf.h" #include "svn_xml.h" #include "opt.h" @@ -1126,3 +1127,9 @@ { svn_xml_make_header2(str, NULL, pool); } + +void +svn_utf_initialize(apr_pool_t *pool) +{ + svn_utf_initialize2(pool, FALSE); +} diff -Naur subversion-1.7.4/subversion/libsvn_subr/utf.c subversion-1.7.4-r1/subversion/libsvn_subr/utf.c --- subversion-1.7.4/subversion/libsvn_subr/utf.c 2011-08-23 17:04:38.000000000 +0200 +++ subversion-1.7.4-r1/subversion/libsvn_subr/utf.c 2012-05-03 00:51:32.039587630 +0200 @@ -23,6 +23,7 @@ +#include #include #include @@ -52,6 +53,7 @@ static const char *SVN_UTF_UTON_XLATE_HANDLE = "svn-utf-uton-xlate-handle"; static const char *SVN_APR_UTF8_CHARSET = "UTF-8"; +static svn_boolean_t assume_native_charset_is_utf8 = FALSE; #if APR_HAS_THREADS static apr_thread_mutex_t *xlate_handle_mutex = NULL; @@ -123,7 +125,8 @@ } void -svn_utf_initialize(apr_pool_t *pool) +svn_utf_initialize2(apr_pool_t *pool, + svn_boolean_t assume_native_utf8) { apr_pool_t *subpool; #if APR_HAS_THREADS @@ -149,6 +152,9 @@ apr_pool_cleanup_register(subpool, NULL, xlate_cleanup, apr_pool_cleanup_null); } + + if (!assume_native_charset_is_utf8) + assume_native_charset_is_utf8 = assume_native_utf8; } /* Return a unique string key based on TOPAGE and FROMPAGE. TOPAGE and @@ -427,7 +433,9 @@ get_ntou_xlate_handle_node(xlate_handle_node_t **ret, apr_pool_t *pool) { return get_xlate_handle_node(ret, SVN_APR_UTF8_CHARSET, - SVN_APR_LOCALE_CHARSET, + assume_native_charset_is_utf8 + ? SVN_APR_UTF8_CHARSET + : SVN_APR_LOCALE_CHARSET, SVN_UTF_NTOU_XLATE_HANDLE, pool); } @@ -440,8 +448,11 @@ static svn_error_t * get_uton_xlate_handle_node(xlate_handle_node_t **ret, apr_pool_t *pool) { - return get_xlate_handle_node(ret, SVN_APR_LOCALE_CHARSET, - SVN_APR_UTF8_CHARSET, + return get_xlate_handle_node(ret, + assume_native_charset_is_utf8 + ? SVN_APR_UTF8_CHARSET + : SVN_APR_LOCALE_CHARSET, + SVN_APR_UTF8_CHARSET, SVN_UTF_UTON_XLATE_HANDLE, pool); } diff -Naur subversion-1.7.4/subversion/mod_dav_svn/mod_dav_svn.c subversion-1.7.4-r1/subversion/mod_dav_svn/mod_dav_svn.c --- subversion-1.7.4/subversion/mod_dav_svn/mod_dav_svn.c 2011-11-21 16:59:12.000000000 +0100 +++ subversion-1.7.4-r1/subversion/mod_dav_svn/mod_dav_svn.c 2012-05-03 00:41:04.251426602 +0200 @@ -22,6 +22,7 @@ * ==================================================================== */ +#include #include #include @@ -55,6 +56,7 @@ /* per-server configuration */ typedef struct server_conf_t { const char *special_uri; + svn_boolean_t use_utf8; } server_conf_t; @@ -111,6 +113,7 @@ init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { svn_error_t *serr; + server_conf_t *conf; ap_add_version_component(p, "SVN/" SVN_VER_NUMBER); serr = svn_fs_initialize(p); @@ -123,7 +126,8 @@ } /* This returns void, so we can't check for error. */ - svn_utf_initialize(p); + conf = ap_get_module_config(s->module_config, &dav_svn_module); + svn_utf_initialize2(p, conf->use_utf8); return OK; } @@ -510,6 +514,19 @@ return NULL; } +static const char * +SVNUseUTF8_cmd(cmd_parms *cmd, void *config, int arg) +{ + server_conf_t *conf; + + conf = ap_get_module_config(cmd->server->module_config, + &dav_svn_module); + conf->use_utf8 = arg; + + return NULL; +} + + /** Accessor functions for the module's configuration state **/ @@ -1021,6 +1038,12 @@ "content over the network (0 for no compression, 9 for " "maximum, 5 is default)."), + /* per server */ + AP_INIT_FLAG("SVNUseUTF8", + SVNUseUTF8_cmd, NULL, + RSRC_CONF, + "use UTF-8 as native character encoding (default is ASCII)."), + { NULL } };