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

encoding - arabic(IBM 864) to UNICODE

Hello,

How to convert IBM 864,IBM 420 & Nafitha(Arabic) to UNICODE.
Thanks

Madhu Alagu

Mar 18 '07 #1
2 3683
"Madhu Alagu" <al*****@gmail.comwrites:
Hello,

How to convert IBM 864,IBM 420 & Nafitha(Arabic) to UNICODE.
Your OS should have some tools for that. On Linux I use 'iconv' to convert
from several encodings to several other encodings.

Another option is checking if Python has those encodings available (are they
standard or platform specific?) and using its own conversion method, as
explained in the docs.

--
Jorge Godoy <jg****@gmail.com>
Mar 18 '07 #2
Madhu Alagu wrote:
How to convert IBM 864,IBM 420 & Nafitha(Arabic) to UNICODE.
You can treat them like every other encoding:
>>s = '\xe1\xec\xf0\xe8\xe1' # *
print s.decode("cp864") # convert from cp864 to unicode
ﻓﻌﹽï»*ﻓ
>>s.decode("cp864").encode("utf8") # convert from cp864 to utf-8
'\xef\xbb\x93\xef\xbb\x8c\xef\xb9\xbd\xef\xbb\xad\ xef\xbb\x93'

To read from or write to a file you can codecs.open() which allows you to
specify an encoding.

Peter

(*) these are arbitrary characters generated by
"".join(chr(ord(c)+128) for c in "alpha")
since I don't know Arabic.
Mar 18 '07 #3

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

Similar topics

3
by: Michael Weir | last post by:
I'm sure this is a very simple thing to do, once you know how to do it, but I am having no fun at all trying to write utf-8 strings to a unicode file. Does anyone have a couple of lines of code...
8
by: Bill Eldridge | last post by:
I'm trying to grab a document off the Web and toss it into a MySQL database, but I keep running into the various encoding problems with Unicode (that aren't a problem for me with GB2312, BIG 5,...
4
by: Majed | last post by:
Hi , all I'm trying to write unicode to a file for another app (not developed with vs2003) to read it. I used StreamWriter with unicode encoding.but I was surprised that the streamwriter adds FFFE...
3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
1
by: Ma³y Piotruœ | last post by:
Hello, Could you help me please with encoding transformations in .NET? I am beginner. I have some code that nearly works - but I have problem with converting from fileEncoding to Unicode (Strings...
5
by: grawsha2000 | last post by:
Hi, I'm trying to save unicode chars. in byte array. The problem is when I try retrieve the saved chars back from the array I get different chars from the one I saved. Code: dim uni as...
1
by: ujjwaltrivedi | last post by:
Hey guys, Can anyone tell me how to create a text file with Unicode Encoding. In am using FileStream Finalfile = new FileStream("finalfile.txt", FileMode.Append, FileAccess.Write); ...
8
by: Erwin Moller | last post by:
Hi group, I could use a bit of guidance on the following matter. I am starting a new project now and must make some decisions regarding encoding. Environment: PHP4.3, Postgres7.4.3 I must...
0
by: deloford | last post by:
Hi This is going to be a question for anyone who is an expert in C# Text Encoding. My situation is this: I have a Sybase database which is firing back ISO-8559 encoded strings. I am unable to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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,...

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.