svn commit: r1926023 - /subversion/trunk/subversion/svnmucc/svnmucc.c

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <[email protected]>
Author: rinrab
Date: Sat May 31 22:23:26 2025
New Revision: 1926023

URL: http://svn.apache.org/viewvc?rev=1926023&view=rev
Log:
svnmucc: Ensure we have property values in UTF-8 encoding.

1. As we read option from apr_getopt and convert it to UTF-8 encoding (later
   on we will read it straight utf8-ized).
2. Then it can either be copied straight to action or be read from a file.
   After reading the file, UTF-8 conversion has to be done.
3. If translation is required, perform it, but we have to tell svn_subst to
   that our propval is already in UTF-8 encoding.

* subversion/svnmucc/svnmucc.c
  (read_propvalue_file): Convert file content to utf8.
  (sub_main): Call svn_subst_translate_string2(), specifying the
   encoding properly.

Modified:
    subversion/trunk/subversion/svnmucc/svnmucc.c

Modified: subversion/trunk/subversion/svnmucc/svnmucc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnmucc/svnmucc.c?rev=1926023&r1=1926022&r2=1926023&view=diff
==============================================================================
--- subversion/trunk/subversion/svnmucc/svnmucc.c (original)
+++ subversion/trunk/subversion/svnmucc/svnmucc.c Sat May 31 22:23:26 2025
@@ -244,6 +244,8 @@ read_propvalue_file(const svn_string_t *
   apr_pool_t *scratch_pool = svn_pool_create(pool);
 
   SVN_ERR(svn_stringbuf_from_file2(&value, filename, scratch_pool));
+  SVN_ERR(svn_utf_stringbuf_to_utf8(&value, value, scratch_pool));
+
   *value_p = svn_string_create_from_buf(value, pool);
   svn_pool_destroy(scratch_pool);
   return SVN_NO_ERROR;
@@ -866,9 +868,9 @@ sub_main(int *exit_code,
               && svn_prop_needs_translation(action->prop_name))
             {
               svn_string_t *translated_value;
-              SVN_ERR_W(svn_subst_translate_string2(&translated_value, NULL,
-                                                    NULL, action->prop_value,
-                                                    NULL, FALSE, pool, pool),
+              SVN_ERR_W(svn_subst_translate_string2(
+                            &translated_value, NULL, NULL, action->prop_value,
+                            "UTF-8", FALSE, pool, pool),
                         "Error normalizing property value");
               action->prop_value = translated_value;
             }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.