473,386 Members | 1,828 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.

codec to parse raw UCS data?



Where can I find a list and documentation for codecs?
What I want to do is to make a unicode string out of unicode data.
for example. I am parsing NTFS metadata, that contains filenames as
UCS-2 code, so I have a binary string that pretends to be a UCS-2.
Currently I am using hand-written module, a wrapper to iconv library, to make
translation of this data (that is, I used it for that task).
However, I am aware of python's codecs that are supposed to do the same
thing in much prettier way.. So, as long as I can do things like
st = u'\uxxxx' and such, I could construct and exec it, but this is ugly...
Shouldn't there be a simple thing like <bin.string>.decode("UCS-2")
that would return a python's unicode string?
Or perhaps I've missed something in the documentation...
Jul 18 '05 #1
1 2637
Oleg Leschov wrote:
Where can I find a list and documentation for codecs?
What I want to do is to make a unicode string out of unicode data.
for example. I am parsing NTFS metadata, that contains filenames as
UCS-2 code, so I have a binary string that pretends to be a UCS-2.


the "utf-16-le" codec is probably what you want.

(utf-16 is basically ucs-2 plus mechanisms to encode characters outside
the 16-bit BMP set; IIRC, Windows 2k and later uses utf-16, not ucs-2).

</F>


Jul 18 '05 #2

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

Similar topics

5
by: Fuzzyman | last post by:
Sorry if my terminology is wrong..... but I'm having intermittent problems dealing with accented characters in python. (Only from the 8 bit latin-1 character set I think..) I've written an...
2
by: Max M | last post by:
Is there any codec available for handling The special UTF-7 codec for IMAP? I have searched the web for info, but there only seem to be discussions about it. Not actual implementations. This...
1
by: John Perks and Sarah Mount | last post by:
(My Python uses UTF16 natively; can someone with UTF32 Python let me know if that behaves differently?) >>> import codecs >>> u'\ud800' # part of surrogate pair u'\ud800'...
3
by: thomas Armstrong | last post by:
Hi Using Python 2.3.4 + Feedparser 3.3 (a library to parse XML documents) I'm trying to parse a UTF-8 document with special characters like acute-accent vowels: -------- <?xml version="1.0"...
11
by: UJ | last post by:
If I've got a video/audio file, how can I tell what Codec it needs? I want to be able to let the user upload a file to a server but I want to make sure before hand that the codec is already...
9
by: beni.cherniavsky | last post by:
Python seems to be missing a UCS-32 codec, even in wide builds (not that it the build should matter). Is there some deep reason or should I just contribute a patch? If it's just a bug, should I...
0
by: elizabeth.kegel | last post by:
Hello- I have a webform with a link that needs to open an audio file *.wma. *.mp3, etc. What is odd is I am able to click on the file and the Windows Media Player opens and the audio file plays. ...
4
by: Oleg Parashchenko | last post by:
Hello, I'm working on an unicode-aware application. I like to use "print" to debug programs, but in this case it was nightmare. The most popular result of "print" was: UnicodeDecodeError:...
3
by: Torsten Bronger | last post by:
Hallöchen! I'd like to map general unicode strings to safe filename. I tried punycode but it is case-sensitive, which Windows is not. Thus, "Hallo" and "hallo" are mapped to "Hallo-" and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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.