tactlabs / error-archive

All issues related to tact and tact labs work
0 stars 0 forks source link

Unicode issue on python 2.7 #5

Open rajacsp opened 4 years ago

rajacsp commented 4 years ago
2020-04-23 05:04:42,212 - Kwikee - ERROR - ('ascii', u'_PURINA\xae PRO PLAN\xae Dog Medium & Large Adult Sensitive Digestion GRAIN Free Formula rich in Turkey_826_12384757_1024x1024_1', 7, 8, 'ordinal not in range(128)')
Traceback (most recent call last):
  File "/srv/api/api/decorators/restful.py", line 194, in wrapped
    return_value = f(*args, **kwargs)
  File "/srv/api/api/controllers/v1/image_processor.py", line 53, in proxy_with_file_name
    return _proxy(image_processor_link_id, hash_id)
  File "/srv/api/api/controllers/v1/image_processor.py", line 32, in _proxy
    headers.append(('Content-Disposition', 'attachment; filename="{}{}"'.format(image_processor_link.file_name, extension)))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xae' in position 7: ordinal not in range(128)
192.168.0.5 - - [23/Apr/2020 05:04:42] "GET /v1/image-processing/proxy/161/uCSv-BINXn2imxIxx3VS/_PURINA%C2%AE%20PRO%20PLAN%C2%AE%20Dog%20Medium%20&%20Large%20Adult%20Sensitive%20Digestion%20GRAIN%20Free%20Formula%20rich%20in%20Turkey_826_12384757_1024x1024_1.png HTTP/1.1" 500 438 0.746964
(60) accepted ('192.168.0.5', 39736)
2020-04-23 05:04:42,266 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): cms-api.kwikee.com
rajacsp commented 4 years ago

sol: .encode('utf-8')