Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] accept string in a2b and base64?

M.-A. Lemburgmal at egenix.com
Tue Feb 21 10:36:28 CET 2012


Nick Coghlan wrote:> The reason Python 2's implicit str<->unicode conversions are so> problematic isn't just because they're implicit: it's because they> effectively assume *latin-1* as the encoding on the 8-bit str side.The implicit conversion in Python2 only works with ASCII content,pretty much like what you describe here.Note that e.g. UTF-16 is not an ASCII super set, but the ASCIIassumption still works:>>> u'abc'.encode('utf-16-le').decode('ascii')u'a\x00b\x00c\x00'Apart from that nit (which can be resolved in most cases bydisallowing 0 bytes), I still believe that the Python2 implicitconversion between Unicode and 8-bit strings is a very usefulfeature in practice.-- Marc-Andre LemburgeGenix.comProfessional Python Services directly from the Source  (#1, Feb 21 2012)>>> Python/Zope Consulting and Support ...http://www.egenix.com/>>> mxODBC.Zope.Database.Adapter ...http://zope.egenix.com/>>> mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/________________________________________________________________________2012-02-13: Released eGenix pyOpenSSL 0.13http://egenix.com/go262012-02-09: Released mxODBC.Zope.DA 2.0.2http://egenix.com/go252012-02-06: Released eGenix mx Base 3.2.3http://egenix.com/go24::: Try our new mxODBC.Connect Python Database Interface for free ! ::::   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg           Registered at Amtsgericht Duesseldorf: HRB 46611http://www.egenix.com/company/contact/


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp