473,658 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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*********@pyt hon.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***** ************@py thon.org?subjec t=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-list>
List-Post: <mailto:py***** ****@python.org >
List-Help: <mailto:py***** ************@py thon.org?subjec t=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-list>,
<mailto:py***** ************@py thon.org?subjec t=subscribe>
Newsgroups: comp.lang.pytho n
Message-ID: <mailman.1947.1 166794941.32031 .py*********@py thon.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.dc a.giganews.com comp.lang.pytho n: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.alias es.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 1331

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

Similar topics

6
2013
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 ThisIsTheEncodingOfS = s.getencoding() is there are method that tell me that it is unicode value if I provide it with a unicode string?
3
2312
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' >>> sys.getdefaultencoding()
9
3694
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. Nothing special, everything works. Except that non-ascii characters are not displayed properly. The data is stored as XML into a text field. When I use pgsql it's displayed good in the terminal. Now I run my script and print data
5
1841
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 page to utf8? For example, let's say the page is encoded in gb2312 (simple chinese) and I want to keep it in utf-8? 2. Is this a good approach? Can I keep any pages in any languages in this way and return them when requested using utf-8...
13
27975
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 it, and encode it to utf-8 (with string function encode). Thank you for any answer Regards Michal
6
2303
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 please no discussion about the sense of such a module and approach. Andreas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) iD8DBQFDvTlMCJIWIbr9KYwRAhXWAJ9X7XyhUBFJ34MAl1OIIM+psBY58ACg4iMg
15
5415
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 encodings, so I'm sure I'm just screwing something simple up. Can anyone help me? Here's the interactive session. Sorry it's a little verbose, but I figured it would be better to include too much than not enough. I basically expected...
2
6696
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 name. 2. I use the cgi module module to get to the input from the user: .... name = form.value
3
2662
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 copy of the Python documentation) and the reference I provide say, "Neither the list of aliases nor the list of languages is meant to be exhaustive".
0
8330
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.