summaryrefslogtreecommitdiffstats
path: root/Lib/encodings/aliases.py
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2001-05-15 12:00:02 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2001-05-15 12:00:02 (GMT)
commit2d9204199fe8913cca9890f1822413d981587ee5 (patch)
treef0734f9c8721508ebbd472cbc46abd9aa66c44dd /Lib/encodings/aliases.py
parent2e0a654f6edeb58bef3cccffa42c2a236117a88c (diff)
downloadcpython-2d9204199fe8913cca9890f1822413d981587ee5.zip
cpython-2d9204199fe8913cca9890f1822413d981587ee5.tar.gz
cpython-2d9204199fe8913cca9890f1822413d981587ee5.tar.bz2
This patch changes the way the string .encode() method works slightly
and introduces a new method .decode(). The major change is that strg.encode() will no longer try to convert Unicode returns from the codec into a string, but instead pass along the Unicode object as-is. The same is now true for all other codec return types. The underlying C APIs were changed accordingly. Note that even though this does have the potential of breaking existing code, the chances are low since conversion from Unicode previously took place using the default encoding which is normally set to ASCII rendering this auto-conversion mechanism useless for most Unicode encodings. The good news is that you can now use .encode() and .decode() with much greater ease and that the door was opened for better accessibility of the builtin codecs. As demonstration of the new feature, the patch includes a few new codecs which allow string to string encoding and decoding (rot13, hex, zip, uu, base64). Written by Marc-Andre Lemburg. Copyright assigned to the PSF.
Diffstat (limited to 'Lib/encodings/aliases.py')
-rw-r--r--Lib/encodings/aliases.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/encodings/aliases.py b/Lib/encodings/aliases.py
index b9bfd97..5573f6d 100644
--- a/Lib/encodings/aliases.py
+++ b/Lib/encodings/aliases.py
@@ -79,4 +79,13 @@ aliases = {
'tis260': 'tactis',
'sjis': 'shift_jis',
+ # Content transfer/compression encodings
+ 'rot13': 'rot_13',
+ 'base64': 'base64_codec',
+ 'base_64': 'base64_codec',
+ 'zlib': 'zlib_codec',
+ 'zip': 'zlib_codec',
+ 'hex': 'hex_codec',
+ 'uu': 'uu_codec',
+
}