[XML-SIG] SAX characters() output on multiple lines for non-ascii

woodcock woodcocs at hotmail.com
Sun Feb 3 15:12:26 CET 2008


Thanks for your reply. Well I have looked at it again and I lose the repeated
lines if I remove the \n and simplify part of it to: 

        if len(newchars)> 0:
          output = ''.join(newchars)
          sys.stdout.write(output)

Start ELEMENT ='title'
Der Einfluss kleiner naturnaher Retentionsma▀nahmen in der FlΣche auf den
Hochwa
sserabfluss - Kleinrⁿckhaltebecken -.
End ELEMENT ='title'


However if I try and put some of the surrounding text back in either by
concatenating strings or using multiple  sys.stdout.write() calls I get
repetitions of the strings. 

        if len(newchars)> 0:
          output = ''.join(newchars)
          sys.stdout.write("String read is '")
          sys.stdout.write(output)
          sys.stdout.write("'")  


Start ELEMENT ='title'
String read is 'Der Einfluss kleiner naturnaher Retentionsma'String read is
'▀'S
tring read is 'nahmen in der Fl'String read is 'Σ'String read is 'che auf
den Ho
chwasserabfluss - Kleinr'String read is 'ⁿ'String read is 'ckhaltebecken -.'
End ELEMENT ='title'


-- 
View this message in context: http://www.nabble.com/SAX-characters%28%29-output-on-multiple-lines-for-non-ascii-tp15248449p15253815.html
Sent from the Python - xml-sig mailing list archive at Nabble.com.



More information about the XML-SIG mailing list