gpt4 book ai didi

python - 从 HBase 解码 HappyBase 数据

转载 作者:行者123 更新时间:2023-11-28 19:15:58 24 4
gpt4 key购买 nike

在尝试解码来自 HBase 的值时,我看到了一个错误,但很明显 Python 认为它不是 UTF-8 格式,而是将数据放入 HBase 的 Java 应用程序仅以 UTF-8 编码

a = '\x00\x00\x00\x00\x10j\x00\x00\x07\xe8\x02Y' a.decode("UTF-8") Traceback (most recent call last): File "", line 1, in File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0xe8 in position 9: invalid continuation byte

有什么想法吗?

最佳答案

该数据不是有效的 utf-8,所以如果您真的从数据库中检索到它,您应该检查是谁/什么把它放在那里的。

关于python - 从 HBase 解码 HappyBase 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33433262/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com