Re: [Tutor] extra characters in XML

2006-01-12 Thread Ben Vinger
Thanks - it was exactly as you said --- Kent Johnson <[EMAIL PROTECTED]> wrote: > Most likely your XML file is 16-bit unicode, not > utf-8. When ascii text > is represented as unicode, every other byte will be > a null byte. That is > the extra character that shows up as a space or box > depen

Re: [Tutor] extra characters in XML

2006-01-11 Thread Kent Johnson
Ben Vinger wrote: > Found the following (which solved the problem, though > not on the console) at > http://www.jorendorff.com/articles/unicode/python.html > > import codecs > # Open a UTF-8 file in read mode > infile = codecs.open("infile.txt", "r", "utf-8") > # Read its contents as one l

Re: [Tutor] extra characters in XML

2006-01-11 Thread Ben Vinger
Found the following (which solved the problem, though not on the console) at http://www.jorendorff.com/articles/unicode/python.html import codecs # Open a UTF-8 file in read mode infile = codecs.open("infile.txt", "r", "utf-8") # Read its contents as one large Unicode string. text = infi

[Tutor] extra characters in XML

2006-01-11 Thread Ben Vinger
Hello all I want to do the following in an XML file: XFile = open(XmlFile,'r') for line in XFile.readlines(): if line.find('') > 0: print line However, it does not work due to extra characters that appear in the XML file. For example if I use the previous code without the if condition