Permalink
Browse files

img is a unicode object, I think we should encode it to utf-8. I thro…

…w exception when Chinese in img url if use decode.
  • Loading branch information...
cedricporter committed Dec 24, 2012
1 parent e90cc32 commit d85f14e77c17fd9587c423ede2238f331c447c0d
Showing with 2 additions and 2 deletions.
  1. +2 −2 exitwp.py
View
@@ -293,10 +293,10 @@ def get_attachment_path(src, dir, dir_prefix='a'):
for img in i['img_srcs']:
try:
urlretrieve(urljoin(data['header']['link'],
- img.decode('utf-8')),
+ img.encode('utf-8')),
get_attachment_path(img, i['uid']))
except:
- print "\n unable to download " + urljoin(data['header']['link'], img.decode('utf-8'))
+ print "\n unable to download " + urljoin(data['header']['link'], img.encode('utf-8'))
if out is not None:
def toyaml(data):

0 comments on commit d85f14e

Please sign in to comment.