CartoDB / carto-python

CARTO Python client
https://carto.com
BSD 3-Clause "New" or "Revised" License
154 stars 62 forks source link

Unicode characters throw Error #4

Closed uberdog closed 9 years ago

uberdog commented 10 years ago

Inserting text with unicode characters throws a UnicodeEncodeError:

INSERT INTO foo (the_geom, standard_resolution_url, username, caption, created_time, link) VALUES (ST_GeomFromText('POINT(-106.388 39.64517)', 4326),'http://distilleryimage11.instagram.com/1dfcf9d863ae11e180c9123138016265_7.jpg','fernandezmaia', 'Buen día! Hoy empiezo en Golden Peak, parece que el destino hace que nieve cada vez que yo madrugo! Va a ser un laaaargo día', totimestamp(1330613527), 'http://instagr.am/p/HokIZBrPc/') Traceback (most recent call last): File "cartoImport.py", line 45, in cl.sql(sql) File "/usr/local/lib/python2.7/dist-packages/cartodb/cartodb.py", line 67, in sql p = urllib.urlencode({'q': sql}) File "/usr/lib/python2.7/urllib.py", line 1312, in urlencode v = quote_plus(str(v)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 254: ordinal not in range(128)

javisantana commented 10 years ago

have you tried with sql.encode('utf-8') ?

danicarrion commented 9 years ago

dead for 2 years