This post originated from an RSS feed registered with Python Buzz
by Victor Ng.
Original Post: Filemaker's XML is not UTF-8
Feed Title: Victor Ng's Weblog
Feed URL: https://blog.crankycoder.com/feed/atom/
Feed Description: Python Feed
Oh yes. We’ve had some more weird requirements thrown at us. More Filemaker nastiness to contend with.
After a protracted period of wrangling with with the XML thath FMP’s Web Companion spits out, Gerry and I finally figured out what was wrong with the XML all this time (wow - it’s been almost a year).
FMP declares an encoding type of UTF-8 pretty explicitly :
Of course - that’s a bloody lie. The real encoding is latin-1. Yes boys and girls - Filemaker goes to the trouble of specifying the wrong character encoding.
So when parsing the XML, just force the encoding type to ‘latin-1’ and process to your hearts content:
data = unicode(data, ‘latin-1’)
The sooner I get this current project done, the sooner I can kick FMP to the curb.
In other news - we had our product weekend at work this past weekend. Much hilarious behaviour ensued. The technology boys of the company took home the dubious prizes for “Best Return Performance” and “Best Newbie Performance” at the big party on Saturday night.
My recollection of Saturday night is - uhm…. fuzzy at best. I think I made an inappropriate comment about someone being a wiccan. But really - can you blame me?
My import problems with Python seem to have gone away now. We’ve managed the problem by fully qualifying all of our packages. Stupid, ugly, but it works for now. Our code has gone from:
import compass.model.agent as m_agent
to :
import compass.model.agent
Accordingly, we need to qualify the object creation with a fully qualilfied classname when we invoke the constructor.