can't get utf8 / unicode strings from embedded python

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Aug 27 19:24:37 EDT 2013


On Tue, 27 Aug 2013 15:21:00 -0700, David M. Cotter wrote:

> i am already doing (3), and all is working perfectly.  bytestring
> literals are fine, i'm not sure what this trouble is that you speak of.

Neither is anyone else, because your post is completely devoid of any 
context. Who are you talking to?

Wait, let me see if I can peer into my crystal ball and see if the 
spirits tell me what you are talking about... I see a post... no, 
repeated posts, by many people, telling you not to embed Unicode 
characters in Python 2.x plain byte strings...

You know what? You obviously know so much more about Unicode and Python 
than the entire Python community, you must be right. There is no possible 
way that misusing byte strings in this manner could possibly go wrong. 
Since byte strings literals containing Unicode data are "fine", it was 
clearly a complete waste of time to introduce Unicode strings in the 
first place.

Why bother using the official interface designed to work correctly with 
Unicode, when you can rely on an accident of implementation that just 
happens to work correctly in your environment but no guarantee it will 
work correctly anywhere else? What could *possibly* go wrong by relying 
on code working by accident like this?


-- 
Steven



More information about the Python-list mailing list