Re: Decoding bytes to text strings in Python 2

Liste des GroupesRevenir à cl python 
Sujet : Re: Decoding bytes to text strings in Python 2
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.python
Date : 21. Jun 2024, 19:43:13
Autres entêtes
Organisation : Stefan Ram
Message-ID : <Text-20240621184010@ram.dialup.fu-berlin.de>
References : 1
Rayner Lucas <usenet202101@magic-cookie.co.ukNOSPAMPLEASE> wrote or quoted:
What's Python 2 doing here? sys.getdefaultencoding() returns 'ascii',
but it's clearly not attempting to display the bytes as ASCII (or
cp1252, or ISO-8859-1). How is it deciding on some sort of almost-but-
not-quite UTF-8 decoding?

  I didn't really do a super thorough deep dive on this,
  but I'm just giving the initial impression without
  actually being familiar with Tkinter under Python 2,
  so I might be wrong!

  The Text widget typically expects text in Tcl encoding,
  which is usually UTF-8.

  This is independent of the result returned by sys.get-
  defaultencoding()!

  If a UTF-8 string is inserted directly as a bytes object,
  its code points will be displayed correctly by the Text
  widget as long as they are in the BMP (Basic Multilingual
  Plane), as you already found out yourself.

Date Sujet#  Auteur
21 Jun 24 * Decoding bytes to text strings in Python 210Rayner Lucas
21 Jun 24 +* Re: Decoding bytes to text strings in Python 27Chris Angelico
22 Jun 24 i`* Re: Decoding bytes to text strings in Python 26Rayner Lucas
23 Jun 24 i +- Re: Decoding bytes to text strings in Python 2 (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
24 Jun 24 i +- Re: Decoding bytes to text strings in Python 21Chris Angelico
24 Jun 24 i +- Re: Decoding bytes to text strings in Python 21MRAB
24 Jun 24 i +- Re: Decoding bytes to text strings in Python 21Chris Angelico
24 Jun 24 i `- Tkinter and astral characters (was: Decoding bytes to text strings in Python 2)1Peter J. Holzer
21 Jun 24 `* Re: Decoding bytes to text strings in Python 22Stefan Ram
22 Jun 24  `- Re: Decoding bytes to text strings in Python 21Rayner Lucas

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal