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

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

From: Rock Sun <daijun_at_gmail.com>
Date: Wed, 12 Nov 2008 13:43:19 +0800

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.

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-12 06:43:49 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.