add encoding to standard encodings works different in python 2.5?

henk-jan ebbers hjebbers at gmail.com
Fri Dec 22 08:43:07 EST 2006


Greetings,

I use an encoding that is not available in the std python-encodings, say 
encoding 'flup';
under different circumstances a user might wish different version of 
'flup': a strict one or a more relaxed encoding.
(yes I know, this is  terrible, but this is how it is)

in python2.4, I managed this by:
    made flup_strict.py and flup_relaxed.py (coping an encoding from 
python std encodings; using a encoding/decoding map as in CP1252.py, 
with changes in the mapping).
    placed flup_strict.py and flup_relaxed.py  in my 'main'-directory 
(the dir from which the my-python-source starts)
    at start of my python-source: add an alias for the encoding:   
encodings.aliases.aliases['flup']='flup_relaxed'   (if user wishes 
relaxed encoding)
this works; the encoding 'flup' is recognized and used.

when testing with python 2.5, this does not work.
my questions are:
-   should this work in 2.5?
-   how can i get this to work in 2.5 (nice if it would work in both 2.4 
and 2.5)

btw, I use ubuntu linux edgy, with both python 2.4 and 2.5 installed

thanks, Henk-Jan





More information about the Python-list mailing list