[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] bug fix for df command error when view conflicts interactively

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 13 Nov 2008 13:13:00 +0000

On Wed, 2008-11-12 at 13:43 +0800, Rock Sun wrote:
> When we set locale as zh_CN.GBK and view conflict differences interactively
> with '(df) diff-full' command. We will get a errors like below:
>
> svn: Valid UTF-8 data
> (hex: 65 78 74 2d 62 61 73 65 2f 61 2e 74 78 74 2e 73 76 6e 2d 62 61 73 65 09)
> followed by invalid UTF-8 sequence
> (hex: d0 c7 c6 da)
>
> I find the invalid sequence is a date string in Chinese. So I view the
> source code , I find
> the original code has not transform the date string into UTF-8 before
> pass it to other
> string. So when we want to transform it into local encoding as UTF-8,
> we get the
> errors.
>
> I contribute the patch just to encode the date string as UTF-8 before
> it passed to
> other strings.

Rock Sun,

Thank you very much for this patch. I reviewed, partially tested (in
English and French locales, and in zh_CN.GBK verified that it outputs
something not an error), and committed it in r34171.

This will be fixed in Subversion 1.6.0. I have also nominated it for
back-port to 1.5.x, so it may be in the next 1.5.x release.

- Julian

>
> Index: libsvn_diff/diff_file.c
> ===================================================================
> --- libsvn_diff/diff_file.c (revision 34024)
> +++ libsvn_diff/diff_file.c (working copy)
> @@ -1116,6 +1116,8 @@
> apr_time_exp_t exploded_time;
> char time_buffer[64];
> apr_size_t time_len;
> + const char *utf8_timestr;
> +
>
> SVN_ERR(svn_io_stat(&file_info, path, APR_FINFO_MTIME, pool));
> apr_time_exp_lt(&exploded_time, file_info.mtime);
> @@ -1123,8 +1125,10 @@
> apr_strftime(time_buffer, &time_len, sizeof(time_buffer) - 1,
> "%a %b %e %H:%M:%S %Y", &exploded_time);
>
> - *header = apr_psprintf(pool, "%s\t%s", path, time_buffer);
> + SVN_ERR(svn_utf_cstring_to_utf8(&utf8_timestr, time_buffer, pool));
>
> + *header = apr_psprintf(pool, "%s\t%s", path, utf8_timestr);
> +
> return SVN_NO_ERROR;
> }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-11-13 14:13:24 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.