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

Re: [PATCH] Fix an l10n encoding error for a message displayed when a svn subcommand takes an inappropriate option taking an argument.

From: Kobayashi Noritada <nori1_at_dolphin.c.u-tokyo.ac.jp>
Date: 2006-07-11 19:33:03 CEST

Hi,

Could anyone review this patch? This is a patch to fix a genuine
(although tiny) bug for those who use svn under locales with many
multibyte characters, such as CJK-language (ja, ko, and zh) users.
I'd like to see it fixed on 1.4.x.

> I've found a minor l10n bug and created a patch to fix it.
> Could you please review and approve to commit it?
>
> # Sorry for a long title; I don't know how to describe this bug shortly...
>
> The bug is...
>
> In using svn with a locale for which translation for a message " arg"
> contains non-ASCII characters, when an option taking an argument is not
> appropriate for the subcommand, an encoding error occurs like:
>
> nori1[17:03]% svn cat -c20043 saba:~/svnwc/subversion-trunk
> subversion/libsvn_subr/utf.c:532: (apr_err=22)
> svn: Can't convert string from native encoding to 'UTF-8':
> subversion/libsvn_subr/utf.c:530: (apr_err=22)
> svn: -c [--change] <?\229?\188?\149?\230?\149?\176>
>
> (Actually, the second message "Can't convert..." is localized;
> it is manually retranslated into English here :-) )
>
> With LC_MESSAGES=C, of course, unlocalized message is correctly displayed:
>
> nori1[18:08]% LC_MESSAGES=C svn cat -c20043 saba:~/svnwc/subversion-trunk
> Subcommand 'cat' doesn't accept option '-c [--change] arg'
> Type 'svn help cat' for usage.
>
> And in the same conditions for svnadmin, svnlook, and svnsync, which have
> both subcommands and options taking an argument, localized messages are
> correctly displayed.
> This patch makes relevant code in subversion/svn/main.c close to one for
> svnadmin, svnlook, and svnsync.

Thanks,

-nori

[[[
Fix an l10n encoding error for a message displayed when a svn subcommand
takes an inappropriate option taking an argument.

This bug occurs only when using svn with a locale for which translation
for a message " arg" contains non-ASCII characters. svnadmin, svnlook,
and svnsync are not affected.

* subversion/svn/main.c
  (main): Don't apply svn_utf_cstring_to_utf8 to UTF-8 strings generated
  by svn_opt_format_option, partly reverting r9795.
]]]

Index: subversion/svn/main.c
===================================================================
--- subversion/svn/main.c (revision 20532)
+++ subversion/svn/main.c (working copy)
@@ -1285,15 +1285,11 @@
 
       if (! svn_opt_subcommand_takes_option2(subcommand, opt_id))
         {
- const char *optstr, *optstr_utf8, *cmdname_utf8;
+ const char *optstr;
           const apr_getopt_option_t *badopt =
             svn_opt_get_option_from_code2(opt_id, svn_cl__options,
                                           subcommand, pool);
           svn_opt_format_option(&optstr, badopt, FALSE, pool);
- if ((err = svn_utf_cstring_to_utf8(&optstr_utf8, optstr, pool))
- || (err = svn_utf_cstring_to_utf8(&cmdname_utf8,
- subcommand->name, pool)))
- return svn_cmdline_handle_exit_error(err, pool, "svn: ");
           if (subcommand->name[0] == '-')
             svn_cl__help(NULL, NULL, pool);
           else
@@ -1301,7 +1297,7 @@
               (svn_cmdline_fprintf
                (stderr, pool, _("Subcommand '%s' doesn't accept option '%s'\n"
                                 "Type 'svn help %s' for usage.\n"),
- cmdname_utf8, optstr_utf8, cmdname_utf8));
+ subcommand->name, optstr, subcommand->name));
           svn_pool_destroy(pool);
           return EXIT_FAILURE;
         }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jul 11 19:33:32 2006

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.