DynastyWuTangStan
New Member
I'm working on a web app that pulls in a list of tweets through a python script. When I pull in a tweet that contains an em dash, I'm unable to parse the XML file.My script is:\[code\]#! /usr/bin/pythonimport cgifrom peewee import *from sql_connect import *import sql_connectimport sysxmlString = ""# Create XML stringxmlString += "<TweetList>"tweets = Tweet_Info.select()for tweet in tweets: xmlString += "<Tweet>" xmlString += "<UserName>" xmlString += tweet.user xmlString += "</UserName>" xmlString += "<UserImage>" xmlString += tweet.user_image_url xmlString += "</UserImage>" xmlString += "<Text>" xmlString += tweet.text xmlString += "</Text>" xmlString += "</Tweet>"xmlString += "</TweetList>"# Print beginning xml stuffprint "Content-Type: text/xml"printprint '<?xml version="1.0" encoding="UTF-8"?>' print xmlString\[/code\]The error it gives when I load the python script in the browser is:\[code\]XML Parsing Error: no element foundLocation: http://localhost/cgi-bin/GetTweets2.pyLine Number 2, Column 1:\[/code\]I feel like the solution to this is probably fairly simple. I've tried using a variety of different encoding types for the xml, but with no success. Is there a specific encoding type that I should use? Or is there a simple way of filtering out a special character that I'm missing?