From: Austin Ziegler Date: 2006-06-29T02:33:36+09:00 Subject: Re: Unicode roadmap? On 6/28/06, Yukihiro Matsumoto wrote: >| I have suggested to Matz that we adopt the u"string" format so that >| we have a literal constructor for Unicode strings (which is by far >| the more common need). > I am not sure how much this is more useful than usual string literals > plus unicode encoding pragma. I'm not sure I like the encoding pragma, personally, since it's at the file level. Consider this: raise "Not PNG." unless @top[0, 8] == "\x89PNG\x0d\x0a\x1a\x0a" If I understand the encoding pragma correctly, both the "Not PNG" and the matching string will be treated as Unicode, and the test string is not valid Unicode. Better, from my perspective: raise u"Not PNG." unless @top[0, 8] == "\x89PNG\x0d\x0a\x1a\x0a" That way, I *mark* the strings for which I want Unicode format. The encoding pragma makes it hard to do mixed content files. (This example, by the way, is *specifically* artificial, but the code involved is real. It's image matching code with error messages if there's a mismatch.) -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca