In trying to fix up a PML (Palm Markup Language) file, it appears as if my test file has non-ASCII characters which is causing MakeBook to complain. The solution would be to strip out all the non-ASCII chars in the PML.
So in attempting to fix this in python, I have
import unicodedata, fileinput
for line in fileinput.input():
print unicodedata.normalize('NFKD', line).encode('ascii','ignore')
However, this results in an error that line must be "unicode, not str". Here's a file fragment.
\B1a\B \tintense, disordered and often destructive rage†.†.†.\t
Not quite sure how to properly pass line in to be processed at this point.
Try print line.decode('iso-8859-1').encode('ascii', 'ignore')
-- that should be much closer to what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With