Conversation
Notices
-
!python #quirk: "%s, %s" % (a, b) fails if a is unicode and b is str and b contrains non-ascii chars. it works if both are str! #wtf
Wednesday, 11-Aug-10 10:13:48 UTC from web- Singer Dan likes this.
-
@brightbyte it's not a bug it's a feature ! !python tries to learn you NOT TO mix unicode and st
-
@brightbyte try using u"%s, %s" like a good boy. !python
-
@ralsina That still fails when b contains non-ascii. So @brighbyte has to learn about unicode anyway.
-
@bj did you try it? It works: http://is.gd/ecWjE -- The u"%s %s" means both are coerced to unicode when interpolated, so there's no problem.
-
@ralsina tried u"%s %s", did no good. even more confusing. anyway, doing everything in u and encoding the whole s at the very end works.