Index: subversion/include/svn_utf.h =================================================================== --- subversion/include/svn_utf.h (revision 19012) +++ subversion/include/svn_utf.h (working copy) @@ -82,9 +82,7 @@ /** Set @a *dest to a utf8-encoded C string from @a frompage C string - * @a src; allocate @a *dest in @a pool. Use @a convset_key as the - * cache key for the charset converter; if it's NULL, don't cache the - * converter. + * @a src; allocate @a *dest in @a pool. @a convset_key is ignored. */ svn_error_t *svn_utf_cstring_to_utf8_ex(const char **dest, const char *src, @@ -118,9 +116,7 @@ /** Set @a *dest to a @a topage encoded C string from utf8 C string - * @a src; allocate @a *dest in @a pool. Use @a convset_key as the - * cache key for the charset converter; if it's NULL, don't cache the - * converter. + * @a src; allocate @a *dest in @a pool. @a convset_key is ignored. */ svn_error_t *svn_utf_cstring_from_utf8_ex(const char **dest, const char *src, Index: subversion/libsvn_repos/hooks.c =================================================================== --- subversion/libsvn_repos/hooks.c (revision 19012) +++ subversion/libsvn_repos/hooks.c (working copy) @@ -199,8 +199,7 @@ for (i = 0; args[i] != NULL; i++) { SVN_ERR(svn_utf_cstring_from_utf8_ex((const char**)(&(native_args[i])), - args[i], (const char *)0, - "svn-repos-utoe-xlate-handle", + args[i], (const char *)0, NULL, pool)); } @@ -366,9 +365,7 @@ /* OS400 scripts produce EBCDIC stderr, so convert it. */ SVN_ERR(svn_utf_cstring_to_utf8_ex(&script_stderr_utf8, script_output->data, - (const char*)0, - "svn-repos-etou-xlate-handle", - pool)); + (const char*)0, NULL, pool)); } if (WIFEXITED(exitcode)) Index: subversion/libsvn_subr/cmdline.c =================================================================== --- subversion/libsvn_subr/cmdline.c (revision 19012) +++ subversion/libsvn_subr/cmdline.c (working copy) @@ -43,13 +43,6 @@ #include "svn_private_config.h" -#define SVN_UTF_CONTOU_XLATE_HANDLE "svn-utf-contou-xlate-handle" -#define SVN_UTF_UTOCON_XLATE_HANDLE "svn-utf-utocon-xlate-handle" - -#ifdef AS400_UTF8 -#define SVN_UTF_ETOU_XLATE_HANDLE "svn-utf-etou-xlate-handle" -#endif - /* The stdin encoding. If null, it's the same as the native encoding. */ static const char *input_encoding = NULL; @@ -195,8 +188,8 @@ if (output_encoding == NULL) return svn_utf_cstring_from_utf8(dest, src, pool); else - return svn_utf_cstring_from_utf8_ex(dest, src, output_encoding, - SVN_UTF_UTOCON_XLATE_HANDLE, pool); + return svn_utf_cstring_from_utf8_ex(dest, src, output_encoding, NULL, + pool); } @@ -217,8 +210,8 @@ if (input_encoding == NULL) return svn_utf_cstring_to_utf8(dest, src, pool); else - return svn_utf_cstring_to_utf8_ex(dest, src, input_encoding, - SVN_UTF_CONTOU_XLATE_HANDLE, pool); + return svn_utf_cstring_to_utf8_ex(dest, src, input_encoding, NULL, + pool); } @@ -474,9 +467,7 @@ { char *arg_utf8; SVN_ERR(svn_utf_cstring_to_utf8_ex(&arg_utf8, argv[i], - (const char *)0, - SVN_UTF_ETOU_XLATE_HANDLE, - pool)); + (const char *)0, NULL, pool)); argv[i] = arg_utf8; } #endif Index: subversion/libsvn_subr/io.c =================================================================== --- subversion/libsvn_subr/io.c (revision 19012) +++ subversion/libsvn_subr/io.c (working copy) @@ -52,9 +52,6 @@ #include "svn_config.h" #include "svn_private_config.h" -#ifdef AS400 -#define SVN_UTF_UTOE_XLATE_HANDLE "svn-utf-utoe-xlate-handle" -#endif /* Windows is 'aided' by a number of types of applications that @@ -466,9 +463,7 @@ /* On OS400 with UTF support a native cstring is UTF-8, * but symlink() *really* needs an EBCDIC path. */ SVN_ERR(svn_utf_cstring_from_utf8_ex(&unique_name_apr, unique_name, - (const char*)0, - SVN_UTF_UTOE_XLATE_HANDLE, - pool)); + (const char*)0, NULL, pool)); #endif do { @@ -538,8 +533,7 @@ /* On OS400 with UTF support a native cstring is UTF-8, but * readlink() *really* needs an EBCDIC path. */ SVN_ERR(svn_utf_cstring_from_utf8_ex(&path_apr, path, (const char*)0, - SVN_UTF_UTOE_XLATE_HANDLE, - pool)); + NULL, pool)); #endif do { rv = readlink(path_apr, buf, sizeof(buf) - 1); Index: subversion/libsvn_subr/utf.c =================================================================== --- subversion/libsvn_subr/utf.c (revision 19012) +++ subversion/libsvn_subr/utf.c (working copy) @@ -729,6 +729,22 @@ xlate_handle_node_t *node; svn_error_t *err; + /* In the cases of SVN_APR_LOCALE_CHARSET and SVN_APR_DEFAULT_CHARSET + * frompage is really an int, not a valid string. So generate a unique + * key accordingly. The exception is OS400 where code pages are always + * ints. */ +#ifndef AS400 + if (frompage == SVN_APR_LOCALE_CHARSET + || frompage == SVN_APR_DEFAULT_CHARSET) +#endif + convset_key = apr_psprintf(pool, "svn-utf-%dtou-xlate-handle", + (int)frompage); +#ifndef AS400 + else + convset_key = apr_psprintf(pool, "svn-utf-%stou-xlate-handle", + frompage); +#endif + SVN_ERR(get_xlate_handle_node(&node, SVN_APR_UTF8_CHARSET, frompage, convset_key, pool)); err = convert_cstring(dest, src, node, pool); @@ -832,6 +848,23 @@ SVN_ERR(check_utf8(src, strlen(src), pool)); + /* In the cases of SVN_APR_LOCALE_CHARSET and SVN_APR_DEFAULT_CHARSET + * topage is really an int, not a valid string. So generate a unique + * key accordingly. The exception is OS400 where code pages are always + * ints. */ +#ifndef AS400 + if (topage == SVN_APR_LOCALE_CHARSET + || topage == SVN_APR_DEFAULT_CHARSET) +#endif + convset_key = apr_psprintf(pool, "svn-utf-uto%d-xlate-handle", + (int)topage); +#ifndef AS400 + else + convset_key = apr_psprintf(pool, "svn-utf-uto%s-xlate-handle", + topage); +#endif + + SVN_ERR(get_xlate_handle_node(&node, topage, SVN_APR_UTF8_CHARSET, convset_key, pool)); err = convert_cstring(dest, src, node, pool);