Hi All,
I'm trying to write a function to 'clean up' text pasted from, say, MS Word so that angled quotation marks, emdashes and so on are replaced with web-safe characters (ASCII and HTML entity codes).
I've set the encoding as latin-1 in as many places as I can think of.
1. I added the following to the top of the file:
#!/usr/bin/python
# -*- coding: latin-1 -*-
# coding=latin-1
2. In the MainWindow class, I set:
wx.SetDefaultPyEncoding('iso-9959-1')
3. In wx.Font() for the main TextCtrl, I set:
encoding = wx.FONTENCODING_ISO8859_1
Here's what has me befuddled: if I paste an angled open quotation mark into IDLE (with the encoding also set to latin-1), it converts the mark to '\x93'.
However, when I do the same in my wxpython app, it converts the mark to '\u201c' and returns the following UnicodeEncodeError:
"'latin-1' codec can't encode character '\u201c' in position 0: ordinal not in rnage(256)
What on earth am I doing wrong?
Thanks in advance for any help.
Regards,
Ryan