Index: subversion/include/svn_utf.h =================================================================== --- subversion/include/svn_utf.h (revision 18468) +++ subversion/include/svn_utf.h (working copy) @@ -34,6 +34,16 @@ #endif /* __cplusplus */ +#ifndef AS400 +#define SVN_APR_LOCALE_CHARSET APR_LOCALE_CHARSET +#define SVN_APR_DEFAULT_CHARSET APR_DEFAULT_CHARSET +#else +/* APR_LOCALE_CHARSET and APR_DEFAULT_CHARSET are defined as ints on + * OS400. */ +#define SVN_APR_LOCALE_CHARSET (const char*)APR_LOCALE_CHARSET +#define SVN_APR_DEFAULT_CHARSET (const char*)APR_DEFAULT_CHARSET +#endif + /** * Initialize the UTF-8 encoding/decoding routines. * Allocate cached translation handles in a subpool of @a pool. Index: subversion/libsvn_client/diff.c =================================================================== --- subversion/libsvn_client/diff.c (revision 18468) +++ subversion/libsvn_client/diff.c (working copy) @@ -2548,7 +2548,7 @@ { return svn_client_diff3 (options, path1, revision1, path2, revision2, recurse, ignore_ancestry, no_diff_deleted, - ignore_content_type, APR_LOCALE_CHARSET, + ignore_content_type, SVN_APR_LOCALE_CHARSET, outfile, errfile, ctx, pool); } @@ -2648,7 +2648,7 @@ return svn_client_diff_peg3 (options, path, peg_revision, start_revision, end_revision, recurse, ignore_ancestry, no_diff_deleted, ignore_content_type, - APR_LOCALE_CHARSET, outfile, errfile, + SVN_APR_LOCALE_CHARSET, outfile, errfile, ctx, pool); } Index: subversion/libsvn_diff/diff_file.c =================================================================== --- subversion/libsvn_diff/diff_file.c (revision 18468) +++ subversion/libsvn_diff/diff_file.c (working copy) @@ -994,7 +994,7 @@ return svn_diff_file_output_unified2(output_stream, diff, original_path, modified_path, original_header, modified_header, - APR_LOCALE_CHARSET, pool); + SVN_APR_LOCALE_CHARSET, pool); } Index: subversion/libsvn_subr/cmdline.c =================================================================== --- subversion/libsvn_subr/cmdline.c (revision 18468) +++ subversion/libsvn_subr/cmdline.c (working copy) @@ -308,7 +308,7 @@ if (output_encoding) return apr_pstrdup (pool, output_encoding); else - return APR_LOCALE_CHARSET; + return SVN_APR_LOCALE_CHARSET; } int Index: subversion/libsvn_subr/utf.c =================================================================== --- subversion/libsvn_subr/utf.c (revision 18468) +++ subversion/libsvn_subr/utf.c (working copy) @@ -38,6 +38,12 @@ #define SVN_UTF_NTOU_XLATE_HANDLE "svn-utf-ntou-xlate-handle" #define SVN_UTF_UTON_XLATE_HANDLE "svn-utf-uton-xlate-handle" +#ifndef AS400 +#define SVN_APR_UTF8_CHARSET "UTF-8" +#else +#define SVN_APR_UTF8_CHARSET (const char*)1208 +#endif + #if APR_HAS_THREADS static apr_thread_mutex_t *xlate_handle_mutex = NULL; #endif @@ -200,15 +206,26 @@ /* The error handling doesn't support the following cases, since we don't use them currently. Catch this here. */ - assert (frompage != APR_DEFAULT_CHARSET && topage != APR_DEFAULT_CHARSET - && (frompage != APR_LOCALE_CHARSET || topage != APR_LOCALE_CHARSET)); +#ifndef AS400 + /* On OS400 V5R4 with UTF support, APR_DEFAULT_CHARSET and + * APR_LOCALE_CHARSET are both UTF-8 (CCSID 1208), so we won't get far + * with this assert active. */ + assert (frompage != SVN_APR_DEFAULT_CHARSET + && topage != SVN_APR_DEFAULT_CHARSET + && (frompage != SVN_APR_LOCALE_CHARSET + || topage != SVN_APR_LOCALE_CHARSET)); +#endif /* Use the correct pool for creating the handle. */ if (userdata_key && xlate_handle_hash) pool = apr_hash_pool_get (xlate_handle_hash); /* Try to create a handle. */ +#ifndef AS400 apr_err = apr_xlate_open (&handle, topage, frompage, pool); +#else + apr_err = apr_xlate_open (&handle, (int)topage, (int)frompage, pool); +#endif if (APR_STATUS_IS_EINVAL (apr_err) || APR_STATUS_IS_ENOTIMPL (apr_err)) handle = NULL; @@ -217,6 +234,7 @@ const char *errstr; /* Can't use svn_error_wrap_apr here because it calls functions in this file, leading to infinite recursion. */ +#ifndef AS400 if (frompage == APR_LOCALE_CHARSET) errstr = apr_psprintf (pool, _("Can't create a character converter from " @@ -229,6 +247,13 @@ errstr = apr_psprintf (pool, _("Can't create a character converter from " "'%s' to '%s'"), frompage, topage); +#else + /* Handle the error condition normally prevented by the assert + * above. */ + errstr = apr_psprintf (pool, + _("Can't create a character converter from " + "'%i' to '%i'"), frompage, topage); +#endif err = svn_error_create (apr_err, NULL, errstr); goto cleanup; } @@ -449,6 +474,7 @@ /* Can't use svn_error_wrap_apr here because it calls functions in this file, leading to infinite recursion. */ +#ifndef AS400 if (node->frompage == APR_LOCALE_CHARSET) errstr = apr_psprintf (pool, _("Can't convert string from native encoding to '%s':"), @@ -461,6 +487,13 @@ errstr = apr_psprintf (pool, _("Can't convert string from '%s' to '%s':"), node->frompage, node->topage); +#else + /* On OS400 V5R4 every possible node->topage and node->frompage + * *really* is an int. */ + errstr = apr_psprintf + (pool, _("Can't convert string from CCSID '%i' to CCSID '%i'"), + node->frompage, node->topage); +#endif err = svn_error_create (apr_err, NULL, fuzzy_escape (src_data, src_length, pool)); return svn_error_create (apr_err, err, errstr);