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

wddx problem with entities

I'm confused about why I get this error:
UnicodeError: ASCII encoding error: ordinal not in range(128)

when I try to load a wddx file containing this string:
<string>The image file, gif/aperçu.png, does
not exist.</string>

When I loop through the file as if it's text and check the ord() value of
each character, of course it's clean. Do I have to replace numbered entities
in the wddx file before I can wddx.load() it?
thanks!
--tim

example program:
-------------------
from xml.marshal import wddx

datastring = '''<?xml version="1.0"?>
<!DOCTYPE wddxPacket SYSTEM "wddx_0090.dtd">
<wddxPacket version="0.9">
<header/>
<data><struct>
<string>The image file, gif/aperçu.png,does not exist.</string>
</struct></data></wddxPacket>'''

data = wddx.loads(datastring)
Jun 7 '06 #1
1 1361
"Tim Arnold" <ti****@sas.com> wrote in message
news:e6**********@foggy.unx.sas.com...
I'm confused about why I get this error:
UnicodeError: ASCII encoding error: ordinal not in range(128)

when I try to load a wddx file containing this string:
<string>The image file, gif/aperçu.png, does
not exist.</string>

When I loop through the file as if it's text and check the ord() value of
each character, of course it's clean. Do I have to replace numbered
entities in the wddx file before I can wddx.load() it?
thanks!
--tim

example program:
-------------------
from xml.marshal import wddx

datastring = '''<?xml version="1.0"?>
<!DOCTYPE wddxPacket SYSTEM "wddx_0090.dtd">
<wddxPacket version="0.9">
<header/>
<data><struct>
<string>The image file, gif/aperçu.png,does not exist.</string>
</struct></data></wddxPacket>'''

data = wddx.loads(datastring)


Replying to my own post.
I got around this problem, which *looks* like a bug to me, (although I'm
sure I don't understand the internals of xml.marshal) with this:

self.data = wddx.loads(''.join(codecs.open(self.filename,
errors='ignore',encoding='ascii').readlines()))
where self.filename contains the numbered entity.

just in case anyone else out there is using wddx to communicate between
python and php.

--Tim Arnold

Jun 9 '06 #2

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

Similar topics

6
by: Horst Gutmann | last post by:
Hi :-) I currently have quite a big problem with minidom and special chars (for example &uuml;) in HTML. Let's say I have following input file:...
1
by: Richard | last post by:
Does anyone know how to make .NET and wddx work? Thanks.
3
by: Michel de Becdelièvre | last post by:
I have some *performance* trouble reading MathML files in my application (in ASP.Net). - I have small MathML files (2-3k) as input - as (almost) all MathML files these use entities. I have no...
0
by: Fraser Dickson | last post by:
I am building a web based system using ASP.NET and VB.NET which has to interact with a web service which uses XML WDDX packets. I have been given the XML Packet Specification by the Web Service...
0
by: Alexander Widera | last post by:
Hi, i want to call a wddx-service with asp.net ( c# ).... or i want to call a url .... how can i do this? description: - call a url .. - wait until there is a result - or there is a...
4
by: isthar | last post by:
Hi ! i am trying to serialise object which contains some unicode objects but looks like there is no way to do it. File...
2
by: collegekid | last post by:
Hi everyone, basically my problem is this: I am using an Access 2000 format. And--I have four subforms in my main form. (Purpose of this is to track projects.) So in my main form I enter the...
6
by: clintonG | last post by:
Can anybody make sense of this crazy and inconsistent results? // IE7 Feed Reading View disabled displays this raw XML <?xml version="1.0" encoding="utf-8" ?> <!-- AT&T HTML entities & XML...
4
by: SV | last post by:
I am consuming Cold fusion web service in asp.net (VB) application. My problem is: I am not able parse the data. The web service returns: <wddxPacket...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: 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...

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.