format string should be unicode instead byte string

Robert Collins robertc at robertcollins.net
Mon Sep 7 21:57:46 BST 2009


On Mon, 2009-09-07 at 17:22 +1000, Martin Pool wrote:
> 2009/9/7 Robert Collins <robertc at robertcollins.net>:
> > Implicit ascii->unicode conversions are definitely bad.
> >
> > We should rather, I think, teach error.py and other places that str
> > should be utf8-decoded, than splatter u'' on all our strings,
> 
> I'm not sure at what time you want this decoding to happen, and which
> strs will be assumed to be in utf8.  When eg formatting the error
> messages?
> 
> We could for instance define all the _fmts as byte strings and then
> convert them to unicode before %-interpolation.

Yes, precisely.

unicode_fmt = self._fmt.decode('utf8')
return unicode_fmt % ...

-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090907/4e991931/attachment.pgp 


More information about the bazaar mailing list