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

Re: Incorrect UTF-8-smashing of conflict localisations

From: Mattias Engdegård <mattiase_at_bredband.net>
Date: Sun, 12 May 2013 15:05:03 +0200

14 apr 2013 kl. 14.20 skrev Mattias Engdegård:

> When a property conflict is presented, some localised messages will
> be mutilated.

This patch fixes the bug.

[[[
When generating the .prej file for property conflicts, don't destroy
the inserted localised strings by converting the entire file to ASCII;
only the property values should be converted.

* subversion/libsvn_wc/props.c
   (append_prop_conflict): Don't call svn_utf_cstring_from_utf8_fuzzy.
   (prop_conflict_from_skel): Convert property data to ASCII first.
]]]

Index: subversion/libsvn_wc/props.c
===================================================================
--- subversion/libsvn_wc/props.c (revision 1481396)
+++ subversion/libsvn_wc/props.c (working copy)
@@ -81,12 +81,10 @@
   /* TODO: someday, perhaps prefix each conflict_description with a
      timestamp or something? */
   const svn_string_t *conflict_desc;
- const char *native_text;
 
   SVN_ERR(prop_conflict_from_skel(&conflict_desc, prop_skel, pool, pool));
- native_text = svn_utf_cstring_from_utf8_fuzzy(conflict_desc->data, pool);
 
- return svn_stream_puts(stream, native_text);
+ return svn_stream_puts(stream, conflict_desc->data);
 }
 
 /*---------------------------------------------------------------------*/
@@ -614,12 +612,26 @@
           const char *mine_marker = _("<<<<<<< (local property value)");
           const char *incoming_marker = _(">>>>>>> (incoming property value)");
           const char *separator = "=======";
+ svn_string_t *original_ascii =
+ svn_string_create(svn_utf_cstring_from_utf8_fuzzy(original->data,
+ scratch_pool),
+ scratch_pool);
+ svn_string_t *mine_ascii =
+ svn_string_create(svn_utf_cstring_from_utf8_fuzzy(mine->data,
+ scratch_pool),
+ scratch_pool);
+ svn_string_t *incoming_ascii =
+ svn_string_create(svn_utf_cstring_from_utf8_fuzzy(incoming->data,
+ scratch_pool),
+ scratch_pool);
 
           style = svn_diff_conflict_display_modified_latest;
           stream = svn_stream_from_stringbuf(buf, scratch_pool);
           SVN_ERR(svn_stream_skip(stream, buf->len));
           SVN_ERR(svn_diff_mem_string_output_merge2(stream, diff,
- original, mine, incoming,
+ original_ascii,
+ mine_ascii,
+ incoming_ascii,
                                                     NULL, mine_marker,
                                                     incoming_marker, separator,
                                                     style, scratch_pool));

Received on 2013-05-12 15:05:45 CEST

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