superset icon indicating copy to clipboard operation
superset copied to clipboard

'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)

Open wgzhao opened this issue 10 years ago • 3 comments

When i use timeseries-based charts. and the groupable column include chinese ,it occurred.

the output in console is the following:

Traceback (most recent call last):
  File "/Users/wgzhao/Codes/caravel/caravel/views.py", line 674, in explore
    payload = obj.get_json()
  File "/Users/wgzhao/Codes/caravel/caravel/viz.py", line 260, in get_json
    'data': self.get_data(),
  File "/Users/wgzhao/Codes/caravel/caravel/viz.py", line 1020, in get_data
    chart_data = self.to_series(df)
  File "/Users/wgzhao/Codes/caravel/caravel/viz.py", line 999, in to_series
    name = ["{}".format(s) for s in name]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)

environment:

OS: Mac OSX 10.11.4 Python: python 2.7 database: MySQL. 2016-05-29 1 17 50

When I use python3.x ,it works!

wgzhao avatar May 29 '16 05:05 wgzhao

Because the default str encoding of Python2.7 is ascii, it conflicts with unicode. The python3 distinguishes the unicode str and byte arrary, and the default encoding is no longer ascii.

Qt7mira avatar Jun 13 '16 05:06 Qt7mira

in : caravel/init.py import sys reload(sys) sys.setdefaultencoding('utf8') @wgzhao

chejinye avatar Jul 06 '16 05:07 chejinye

Notice: this issue has been closed because it has been inactive for 562 days. Feel free to comment and request for this issue to be reopened.

mistercrunch avatar Apr 23 '18 17:04 mistercrunch