Skip to content

Commit

Permalink
Fixes crash when trying to print spanish accented letters like 'á'.
Browse files Browse the repository at this point in the history
	Traceback (most recent call last):
	  File "./exitwp.py", line 353, in <module>
	    data = parse_wp_xml(wpe)
	  File "./exitwp.py", line 164, in parse_wp_xml
	    'items': parse_items(),
	  File "./exitwp.py", line 127, in parse_items
	    body = gi('content:encoded')
	  File "./exitwp.py", line 120, in gi
	    print result
	
	UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 236: ordinal not in range(128)

Now is will display an encoding error on the writing of the files (not resulting on a crash anymore). 

writing............................................................................................
 Parse error on: Tutorial: Using luabind to integrate Lua with C/C++ (pt.2)
.................................

This fix could still be improved to fix the writing but don't really have the time right now.
  • Loading branch information
Goles committed Jul 11, 2013
1 parent 7dafd5e commit a72bcdb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ bin/
build/
include/
.vagrant/
.DS_Store
2 changes: 1 addition & 1 deletion exitwp.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def gi(q, unicode_wrap=True):
tag = q
try:
result = i.find(ns[namespace] + tag).text
print result
print result.encode('utf-8')
except AttributeError:
result = "No Content Found"
if unicode_wrap:
Expand Down

0 comments on commit a72bcdb

Please sign in to comment.