473,386 Members | 1,764 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,386 software developers and data experts.

On Creating Codecs

Hi,
I have been trying to generate codecs for my language in Python using
gencodec.py.
The problem is the codec created does not work.
Here is the process that I followed.
I created a directory inside [python_installation]/tools/scripts and
put in a text file containing the mapping.
Here is a sample from it.
0x63 0x0915 # acsii letter c
0x64 0x0916
0x65 0x0917 # ascii letter e
0x66 0x0918
0x67 0x0919
As my Language was not standardized before Unicode, I have to use
fonts that have been developed using the ascii character set.
Now in the table I map ascii representative values to the char
encoding in Unicode.
Now using gencodec.py I generate the codecs. It gives me a py script
file, which I placed in the [python_installation]/lib/encodings
directory.
Now I try to use the codec from the shell and below is my session on
it.
string = 'cde'
string.encode('nepali') Traceback (most recent call last):
File "<pyshell#1>", line 1, in ?
string.encode('nepali')
File "C:\Python22\lib\encodings\nepali.py", line 18, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeError: charmap encoding error: character maps to <undefined>


I may be doing something wrong. Can you please tell me how to go about
it. I am using Python 2.2 on Windows XP.
Thank you.

PRJoshi
Jul 18 '05 #1
0 1386

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

Similar topics

30
by: Sean R. Lynch | last post by:
I've been playing around with Zope's RestrictedPython, and I think I'm on the way to making the modifications necessary to create a capabilities-based restricted execution system. The idea is to...
3
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...
3
by: Ivan Van Laningham | last post by:
Hi All-- As far as I can tell, after looking only at the documentation (and not searching peps etc.), you cannot query the codecs to give you a list of registered codecs, or a list of possible...
3
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...
2
by: Tamir Khason | last post by:
Anyone have ideas about creating video/audio CODECs with the Framework? -- Tamir Khason You want dot.NET? Just ask: "Please, www.dotnet.us "
7
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...
1
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...
0
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...
2
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 =...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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,...
0
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...

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.