monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Does "mtn status" work correctly only with UTF-8 lo


From: Thomas Keller
Subject: Re: [Monotone-devel] Does "mtn status" work correctly only with UTF-8 locales?
Date: Mon, 22 Sep 2008 02:22:04 +0200
User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707)

Tomohisa Tanaka schrieb:
> Dear Thomas,
> 
> Thank you for your reply.  I have already reported the problem and the
> patch in https://savannah.nongnu.org/bugs/?21870, but nobody fixes it.

Oh, sorry for that. Unfortunately the bug interface there is not used by
many developers. The best place to report bugs is probably still the
mailing list.

>> Smells like a double-encoding bug,
> 
> I also think so.  The method F() and the operator % return an
> i18n_format instance, which has the string encoded with user's locale
> (since it is the string the gettext() returned).  So, the method
> i18n_format::str() does not return an UTF-8 string.  However, the
> constructor utf8() takes a string encoded with user's locale as the
> argument, as follows.
> 
> |     47   string out;
> |...
> |     51   out += (F("Current branch: %s") % branch).str() += '\n';
> |...
> |    100     summary = utf8(out);
> 
> I think the constructor external() must be used for "out".  Please see
> the sample fix in my report.

After diving (yet again) through some of the more obscure parts of
monotone's source code (yeah, the vocab_* files) I have to admit that
almost everything about the "external" type is a lie. In the end this
just wraps a std::string, so no whatsoever conversion / safety takes
place, you could also just directly print out the std::string and would
receive the same result.

I have found another place where the same bug exists - mtn log. But its
not obvious there, because it was forgotten to translate certain UI
phrases. I got around and could compile my changes, but I have yet to
test one certain use case: if the changes affect (in any way) the output
of internal, normalized paths (which are always utf-8). More on that
tomorrow.

Thomas.

-- 
GPG-Key 0x160D1092 | address@hidden | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=en

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]