UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe5 in position 4
See original GitHub issueMake sure these boxes are checked before submitting your issue - thank you!
- I have checked the superset logs for python stacktraces and included it here as text if any
- I have reproduced the issue with at least the latest released version of superset
- I have checked the issue tracker for the same issue and I haven’t found one similar
Superset version
0.15.4
Expected results
change the metadata db from db2 to previous db1 can work
Actual results
after changing to db1, exists the encoding error
Steps to reproduce
- add
?charset=utf8
insqlalchemy_database_uri
, andcreate database db1 character set utf8
, use db1 as the metadata db, works - add
?charset=utf8
insqlalchemy_database_uri
, andcreate database db2 character set utf8
, use db2 as the metadata db, works -
change the
sqlalchemy_database_uri
from db2 to db1 - view a slice or use SQL Lab, occur the encoding bug
python3.5 superset 0.15.4 mysql 5.7
File "/home/jiajie/project/superset/superset/superset/views.py", line 1588, in explore
datasources = sorted(datasources, key=lambda ds: ds.full_name)
File "/home/jiajie/project/superset/superset/superset/views.py", line 1588, in <lambda>
datasources = sorted(datasources, key=lambda ds: ds.full_name)
File "/home/jiajie/project/superset/superset/superset/models.py", line 1155, in full_name
self.database, self.table_name, schema=self.schema)
......................
File "/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.1.5.dev0-py3.5-linux-x86_64.egg/sqlalchemy/orm/strategies.py", line 557, in _load_for_state
return self._emit_lazyload(session, state, ident_key, passive)
File "\<string\>", line 1, in \<lambda\>
File "/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.1.5.dev0-py3.5-linux-x86_64.egg/sqlalchemy/orm/strategies.py", line 603, in _emit_lazyload
return loading.load_on_ident(q, ident_key)
File "/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.1.5.dev0-py3.5-linux-x86_64.egg/sqlalchemy/orm/loading.py", line 223, in load_on_ident
return q.one()
.......
File "/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.1.5.dev0-py3.5-linux-x86_64.egg/sqlalchemy/util/compat.py", line 186, in reraise
raise value
File "/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.1.5.dev0-py3.5-linux-x86_64.egg/sqlalchemy/orm/loading.py", line 75, in instances
rows = [proc(row) for row in fetch]
File "/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.1.5.dev0-py3.5-linux-x86_64.egg/sqlalchemy/orm/loading.py", line 75, in <listcomp>
rows = [proc(row) for row in fetch]
....................
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy_utils/types/encrypted.py", line 261, in process_result_value
decrypted_value = self.engine.decrypt(value)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy_utils/types/encrypted.py", line 89, in decrypt
decrypted = decrypted.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe5 in position 4: invalid continuation byte
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (13 by maintainers)
Top Results From Across the Web
'utf-8' codec can't decode byte - Stack Overflow
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 183: invalid continuation byte. So this is how I fixed it.
Read more >UnicodeDecodeError: 'utf8' codec can't decode ... - ItsMyCode
What is UnicodeDecodeError 'utf8' codec can't decode byte? The UnicodeDecodeError normally happens when decoding a string from a certain coding.
Read more >Python3 Fix→ UnicodeDecodeError: 'utf-8' codec can't decode ...
UnicodeDecodeError : 'utf-8' codec can't decode byte 0x84 in position ... With Encoding (Save As in Notepad); Select UTF-8 for your encoding.
Read more >'utf8' codec can't decode byte 0xa5 in position 0: invalid start ...
Often, while reading the input files, you might encounter an UnicodeDecodeError. · Thus, the error means that the byte 0xa05 at position 0...
Read more >How to resolve a UnicodeDecodeError for a CSV file - Kaggle
_string_box_utf8() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcc in position 1: invalid continuation byte During handling of the above exception, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
this is a workaround you can use - convert the utf field to ascii using mysql expression in the edit dimension.
or include ?charset=utf8 in the SQLAlchemy URL
Here is how I was able to fix this: https://github.com/apache/superset/issues/8538#issuecomment-922061313