Re: Long way around UnicodeDecodeError, or 'ascii' codec can't decode byte



Oleg Parashchenko napisał(a):

I spent two hours fixing it, and I hope it's done. The solution is one
of the ugliest hack I ever written, but it solves the pain. The full
story and the code is in my blog:
http://uucode.com/blog/2007/03/23/shut-up-you-dummy-7-bit-python/
Calling sys.setdefaultencoding might not even help in this case, and
the consensus is that it may be harmful to your code's portability
[1].

Yes, but I think UTF-8 is now everywhere.

No, it is not. Your own system is "not ready for UTF-8", as you stated
somewhere in this blog entry. How can you expect everybody else's system
being utf-8, while "you are not ready for transition"?

It would be better if you write your programs in encoding-agnostic way,
using byte streams only for input and output (yes, printing a debug
statement on terminal *is* a kind of producing the output). An, oh, you
cann't encode/decode text not knowing the encoding...

--
Jarek Zgoda
http://jpa.berlios.de/
.



Relevant Pages

  • Re: The Demise of Medical Ethics and the Old School
    ... I would really appreciate some comments on the blog about this one. ... I've gotten into a scrap with Scalpel where he has ... hate-filled articles about chronic pain patients by revealing my real ... violating the HIPAA laws by blacklisting patients, ...
    (alt.support.chronic-pain)
  • Re: Ping Billie
    ... stones I forgot to put in there. ... is causing me pain. ... into your comments at the blog. ... infusions, and IVIGs. ...
    (alt.support.diabetes)
  • Re: The Demise of Medical Ethics and the Old School
    ... Compliments on the Payne Hertz blog. ... Lots of good opinion, discussion, ... A valid platform for the concerns/problems of cp patients. ... pain patients, particularly when the conversation turns to "drug ...
    (alt.support.chronic-pain)
  • Re: A Modest Proposal...
    ... I like the blog idea. ... I STILL meet resistance.when inquiring about stricly opioid options. ... Next stop a Chronic Pain ... contract/consent form, frequent office visits and probably a psych ...
    (alt.support.chronic-pain)
  • Re: The Drug-Seeker: an Urban Legend?
    ... faking their pain, being a wuss, seeking secondary gains, or some other ... The truth is, experienced doctors and nurses ... I have seen drug seeker estimates as high as 85 percent of the ... Do you know the doctor that commented on my blog, ...
    (alt.support.chronic-pain)