[Python-Dev] Re: adding a bytes sequence type to Python (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Tue Aug 17 01:04:13 CEST 2004
- Previous message: [Python-Dev] Re: adding a bytes sequence type to Python
- Next message: [Python-Dev] Re: adding a bytes sequence type to Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
M.-A. Lemburg wrote:
It is if you stick to writing your binary data using an ASCII compatible encoding -- I wouldn't expect any other encoding for binary data anyway. The most common are ASCII + escape sequences, base64 or hex, all of which are ASCII compatible.
We probably have a different notion of "ASCII compatible" then. I would define it as:
An encoding E is "ASCII compatbible" if strings that only consist of ASCII characters use the same byte representation in E that they use in ASCII.
In that sense, ISO-8859-1 and UTF-8 are also ASCII compatible. Notice that this is also the definition that PEP 263 assumes.
However, byte strings used in source code are not "safe" if they are encoded in ISO-8859-1 under recoding: If the source code is converted to UTF-8 (including the encoding declaration), then the length of the strings changes, as do the byte values inside the string.
Regards, Martin
- Previous message: [Python-Dev] Re: adding a bytes sequence type to Python
- Next message: [Python-Dev] Re: adding a bytes sequence type to Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]