google-images-download icon indicating copy to clipboard operation
google-images-download copied to clipboard

Unicode Decode Error on Accented Spanish Characters

Open jsreaves opened this issue 4 years ago • 2 comments

I get the error below when trying to search for images using keywords with Spanish characters like á, ó, and í. The error occurs when using the library from my own code or with the command line utility. I'm using Python 3.

Screen Shot 2019-09-15 at 7 55 37 PM

jsreaves avatar Sep 16 '19 00:09 jsreaves

The issue is related to line 922 in google_images_download.py file: print(iteration.encode('raw_unicode_escape').decode('utf-8'))

@hardikvasa on commit 18cc56b3ed8e06148fbacaf98b37a24c3f4a635c why did you have to add the encode/decode ? Without this it will also work for non english characters.

davidstrouk avatar Sep 23 '19 21:09 davidstrouk

Here is my fix for this

 try:
    print(iteration.encode('raw_unicode_escape').decode('utf-8'))
except:
    print(iteration.encode('raw_unicode_escape').decode('latin-1'))

dragona avatar Oct 13 '19 23:10 dragona