473,603 Members | 2,642 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Enumerate registered codecs

I see the list of standard encodings in Python 2.4.1 documentation
section 4.9.2.

Is there a method to enumerate the registered codecs at runtime?
Jul 31 '05 #1
3 1552
Paul Watson wrote:
I see the list of standard encodings in Python 2.4.1 documentation
section 4.9.2.

Is there a method to enumerate the registered codecs at runtime?


This has been asked before, within the last couple of months AFAIR. Use
Google to search for codec(s) in this newsgroup in Google groups.

Basically the answer was no. What's your use case?

Jul 31 '05 #2
John Machin wrote:
Paul Watson wrote:
I see the list of standard encodings in Python 2.4.1 documentation
section 4.9.2.

Is there a method to enumerate the registered codecs at runtime?


This has been asked before, within the last couple of months AFAIR. Use
Google to search for codec(s) in this newsgroup in Google groups.

Basically the answer was no. What's your use case?


I need to report the encodings supported. When the user does not enter
a required encoding or enters an invalid encoding, we need to tell them
which encodings are valid and how they are specified. In an embedded
environment I would be concerned that some or most might have been left
out to save space/size/time.

The primary identifier and a descriptive string (localized) need to be
available at a minimum. Having aliases would be a plus.
Aug 1 '05 #3
Paul Watson wrote:
The primary identifier and a descriptive string (localized) need to be
available at a minimum. Having aliases would be a plus.


You will have to implement your own list. Getting the well-known aliases
is possible through encodings.alias es, but a localized descriptive
string was never part of the design - this is something the application
will have to provide.

Regards,
Martin
Aug 1 '05 #4

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

Similar topics

1
2631
by: Pierre Rouleau | last post by:
Hi all, When building a exe for a Python application under Windows XP with The McMillan installer, the insttaltion succeeds but when I run the resulting executable the application tracebacks complaining about a codec not being registered: Traceback (most recent call last): File "<string>", line 222, in ? File "ivcm\buildivcm\out1.pyz/gettext", line 428, in install
5
1664
by: Pekka Niiranen | last post by:
Hi, I have Perl code looping thru lines in the file: line: while (<INFILE>) { ... $_ = do something ... if (/#START/) { # Start inner loop
3
4729
by: Eric Brunel | last post by:
Hi all, I just found a problem in the xreadlines method/module when used with codecs.open: the codec specified in the open does not seem to be taken into account by xreadlines which also returns byte-strings instead of unicode strings. For example, if a file foo.txt contains some text encoded in latin1: >>> import codecs >>> f = codecs.open('foo.txt', 'r', 'utf-8', 'replace') >>>
3
1921
by: Paul Watson | last post by:
$ python Python 2.4.1 (#1, May 16 2005, 15:19:29) on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import codecs >>> codecs.lookup('ascii') (<built-in function ascii_encode>, <built-in function ascii_decode>, <class encodings.ascii.StreamReader at 0xb7f1302c>, <class encodings.ascii.StreamWriter at 0xb7f82fbc>) >>> codecs.lookup('mbcs')
1
7000
by: Zhongjian Lu | last post by:
Hi Guys, I was processing a UTF-16 coded file with BOM and was not aware of the codecs package at first. I wrote the following code: ===== Code 1============================ for i in open("d:\python24\lzjtest.xml", 'r').readlines(): i = i.decode("utf-16") print i ======================================= Output was:
7
13477
by: Mike Currie | last post by:
I'm trying to write out files that have utf-8 characters 0x85 and 0x08 in them. Every configuration I try I get a UnicodeError: ascii codec can't decode byte 0x85 in position 255: oridinal not in range(128) I've tried using the codecs.open('foo.txt', 'rU', 'utf-8', errors='strict') and that doesn't work and I've also try wrapping the file in an utf8_writer using codecs.lookup('utf8') Any clues?
1
2916
by: David Hughes | last post by:
I used this function successfully with Python 2.4 to alter the encoding of a set of database records from latin-1 to utf-8, but the same program raises an exception using Python 2.5. This small example shows the problem: import codecs fo = open('test.dat', 'w') fo.write('G\xe2teaux') fo.close()
0
2039
by: yrogirg | last post by:
Actually, I need utf-8 to utf-8 encoding which would change the text to another keyboard layout (e.g. from english to russian ghbdtn -> –“…◊Ň‘) and would not affect other symbols. I`m totally new to python and to more or less advanced programming. I couldn`t find the answer to the question anywhere. I`ve tried create simple utf to utf codec for some symbols but it doesn`t work. Here it is.
2
2099
by: George Sakkis | last post by:
I'm trying to use codecs.open() and I see two issues when I pass encoding='utf8': 1) Newlines are hardcoded to LINEFEED (ascii 10) instead of the platform-specific byte(s). import codecs f = codecs.open('tmp.txt', 'w', encoding='utf8') s = u'\u0391\u03b8\u03ae\u03bd\u03b1' print >f, s
0
7997
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8419
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...
0
8406
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8065
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,...
0
8274
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectóplanning, coding, testing, and deploymentówithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5441
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3954
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2433
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

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.