The returned line contains unreadable symbols



  • Use psycopg2 for postgress OBD. I get this kind of hard value when I ask for the D.O.D.: Must be insider's guide to a woman's. Help me find a solution.



  • insider’s guide It's-- it's so-called. http://www.hanselman.com/blog/WhyTheAskObamaTweetWasGarbledOnScreenKnowYourUTF8UnicodeASCIIAndANSIDecodingMrPresident.aspx which are produced when the text encoded in one code is shown in another incompatible code:

    >>> print(u"insider’s guide to a woman’".encode('cp1251').decode('utf-8'))
    insider’s guide to a woman’
    

    In your case, utf-8, the text was shown using cp1251.

    To reduce the probability of such errors, keep the text like Junicod instead of baytha: convert at the inlet of Yunicod, use the Yunikod inside the program, codify in the bayta outlet (if necessary) е:

    unicode_text = bytestring.decode(character_encoding)
    bytestring = unicode_text.encode(character_encoding)
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2