UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

akhil1988 akhilanger at gmail.com
Thu Jul 16 07:00:00 EDT 2009


I have switched to python 3.1 , but now I am getting some syntax errors in
the code:

File "./customWikiExtractor.py", line 81
    __char_entities =  {' '   :u'\u00A0', '¡' :u'\u00A1',
'¢'    :u'\u00A2',
                                            ^
SyntaxError: invalid syntax

line 81 is:
__char_entities =  {' '   :u'\u00A0', '¡' :u'\u00A1', '¢'   
:u'\u00A2',
                        '£'  :u'\u00A3', '¤':u'\u00A4', '¥'    
:u'\u00A5',
                        '¦' :u'\u00A6', '§'  :u'\u00A7', '¨'    
:u'\u00A8',
                        '©'   :u'\u00A9', 'ª'  :u'\u00AA',
'«'   :u'\u00AB',
                        '¬'    :u'\u00AC', '­'   :u'\u00AD', '®'    
:u'\u00AE',
                        '¯'   :u'\u00AF', '°'   :u'\u00B0',
'±'  :u'\u00B1',
                        '²'   :u'\u00B2', '³'  :u'\u00B3',
'´'   :u'\u00B4',
                        'µ'  :u'\u00B5', '¶'  :u'\u00B6',
'·'  :u'\u00B7',
                        '¸'  :u'\u00B8', '¹'  :u'\u00B9',
'º'    :u'\u00BA',}

--Akhil


John Nagle-2 wrote:
> 
> akhil1988 wrote:
>> Sorry, it is sgmllib.py and not sgmmlib.py
> 
>     Oh, that bug again.  See
> 
> 	http://bugs.python.org/issue1651995
> 
> It's a bug in SGMLParser.  When Python 2.5 restricted ASCII to 0..127,
> SGMLParser needed to be modified, but wasn't.
> 
> I reported that bug in February 2007.  It was fixed in
> Python 2.6 and 3.0 on March 31, 2009.
> 
> 					John Nagle
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
> 

-- 
View this message in context: http://www.nabble.com/UnicodeEncodeError%3A-%27ascii%27-codec-can%27t-encode-character-u%27%5Cxb7%27-in-position-13%3A-ordinal-not-in-range%28128%29-tp24509879p24514309.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list