473,587 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xml.parsers.exp at and utf-8

I have this code:

import xml.parsers.exp at
parser = xml.parsers.exp at.ParserCreate (encoding="UTF-8")
text = unicode("<div>þ órður</div>",'UTF-8')
print parser.Parse(te xt,1)

And this is what I get:
UnicodeEncodeEr ror: 'ascii' codec can't encode characters in position
5-6: ordinal not in range(128)
I think I've tried all variations possible but I always get errors.
Anyone know what I'm doing wrong?

Jul 19 '05 #1
0 1458

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

Similar topics

1
6044
by: Will Stuyvesant | last post by:
There seems to be no XML parser that can do validation in the Python Standard Libraries. And I am stuck with Python 2.1.1. until my web master upgrades (I use Python for CGI). I know pyXML has validating parsers, but I can not compile things on the (unix) webserver. And even if I could, the compiler I have access to would be different...
2
3918
by: Thomas Guettler | last post by:
Hi! What are the difference between xml.parsers.expat and xml.sax? Up to now I used xml.sax.make_parser and subclass from ContentHandler. I think xml.sax.make_parser uses expat as default. Why should I want to use xml.parsers.expat?
4
1966
by: Jakob Møbjerg Nielsen | last post by:
Expat keeps telling me that there is "junk after document element". I've tried different encoding, and I'm quite sure that the buffer is nul-terminated. I really have no idea to what the problem might be. Any ideas? X-POST: comp.lang.c, comp.text.xml (I don't know which group is the right one) -----Source code----- #include <stdio.h>...
4
3797
by: Laurens | last post by:
Hi, Is there any good open-source C++ XML parser library that isn't as huge as Xerces? The Xerces DLL is about 2.4 Mb in size, which is far too big for my application. (It doesn't seem to be possible to link Xerces statically.) The parser doesn't need to do DTD/Schema validation, but it should be able to expand entities. I also need a...
2
1162
by: Nikhil | last post by:
Hi, Does anybody knows faster parsers than C - RXP in validating category and Expat in non-validating category? Are both of them (or their faster ones) portable in Mac OS X? Thanks, Nikhil
1
1551
by: bloon | last post by:
I know there are three most popular open-source XML parsers. They are expat, libxml, and Xerces. All three are cross-platform. Does anybody test these three parsers? Which one is the fastest when loading and parsing large XML files? Thanks.
2
3732
by: dwelch91 | last post by:
Hi, c.l.p.'ers- I am having a problem with the import of xml.parsers.expat that has gotten me completely stumped. I have two programs, one a PyQt program and one a command line (text) program that both eventually call the same code that imports xml.parsers.expat. Both give me different results... The code that gets called is (print...
6
2635
by: kaens | last post by:
Hey everyone, this may be a stupid question, but I noticed the following and as I'm pretty new to using xml and python, I was wondering if I could get an explanation. Let's say I write a simple xml parser, for an xml file that just loads the content of each tag into a dict (the xml file doesn't have multiple hierarchies in it, it's flat...
1
4203
by: josh logan | last post by:
Vincent Yau <y...@ohsu.eduwrites: Fast-forward to 2008 I installed Python 3.0b2 on a Windows Vista laptop (after having previously installed Python 2.5), and I am getting this same error: Traceback (most recent call last): File "Programming\Python\monkeys.py", line 24, in <module> test_parse(sys.argv)
0
7843
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...
0
8206
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. ...
1
7967
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...
0
8220
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...
1
5713
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...
0
5392
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...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
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
0
1185
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...

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.