473,419 Members | 1,704 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

add encoding to standard encodings works different in python 2.5?

Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-BeenThere: py*********@python.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <http://mail.python.org/mailman/listinfo/python-list>,
<mailto:py*****************@python.org?subject=uns ubscribe>
List-Archive: <http://mail.python.org/pipermail/python-list>
List-Post: <mailto:py*********@python.org>
List-Help: <mailto:py*****************@python.org?subject=hel p>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-list>,
<mailto:py*****************@python.org?subject=sub scribe>
Newsgroups: comp.lang.python
Message-ID: <mailman.1947.1166794941.32031.py*********@python. org>
Lines: 30
NNTP-Posting-Host: 194.109.207.14
X-Trace: 1166794941 news.xs4all.nl 339 [::ffff:194.109.207.14]:53104
X-Complaints-To: ab***@xs4all.nl
Xref: number1.nntp.dca.giganews.com comp.lang.python:512429

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
Dec 22 '06 #1
0 1319

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Golawala, Moiz M (GE Infrastructure) | last post by:
Hi all, I have a some data is encoded into something thing. I want to find out the encoding of that piece of data. For example s = u"somedata" I want to do something like ...
3
by: Pekka Niiranen | last post by:
Hi, Probing my system from Python 2.3.4 gives >>> import locale, sys >>> locale.getdefaultlocale() ('fi_FI', 'cp1252') >>> locale.getpreferredencoding() 'cp1252' >>>...
9
by: Ksenia Marasanova | last post by:
Hi, I have a little problem with encoding. Was hoping maybe anyone can help me to solve it. There is some amount of data in a database (PG) that must be inserted into Excel sheet and emailed....
5
by: jalil | last post by:
1. I download a page in python using urllib and now want to convert and keep it as utf-8? I already know the original encoding of the page. What calls should I make to convert the encoding of the...
13
by: Michal | last post by:
Hello, is there any way how to detect string encoding in Python? I need to proccess several files. Each of them could be encoded in different charset (iso-8859-2, cp1250, etc). I want to detect...
6
by: Andreas Jung | last post by:
Does anyone know of a Python module that is able to sniff the encoding of text? Please: I know that there is no reliable way to do this but I need something that works for most of the case...so...
15
by: Steven Bethard | last post by:
I'm having trouble using elementtree with an XML file that has some gbk-encoded text. (I can't read Chinese, so I'm taking their word for it that it's gbk-encoded.) I always have trouble with...
2
by: joakim.hove | last post by:
Hello, I am having great problems writing norwegian characters æøå to file from a python application. My (simplified) scenario is as follows: 1. I have a web form where the user can enter his...
3
by: Philip Semanchuk | last post by:
On Nov 9, 2008, at 7:00 PM, News123 wrote: Look under the heading "Standard Encodings": http://docs.python.org/library/codecs.html Note that both the page you found (which appears to be a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.