format string should be unicode instead byte string

INADA Naoki songofacandy at gmail.com
Tue Sep 8 00:49:54 BST 2009


> Actually, I think he has it backwards. If you do:
>
> "path: %s" % (path,)
>
> Then if 'path' is unicode then it will upcast the string to Unicode. If
> path is 'bytes' and contains non-ascii characters, it stays bytes.

I'm sorry. I'm wrong.

> However if you do:
>
> u"path: %s" % (path,)
>
> If 'path' is Unicode, things are fine, and if 'path' is ascii things are
> fine (auto-upcasting ascii => unicode). However if 'path' is non-ascii
> characters you get a failure.

Yes.
So non-ascii byte string (including path string) should not be inside
application.

-- 
Naoki INADA  <songofacandy at gmail.com>



More information about the bazaar mailing list