我正在尝试编写并检索一个带有特殊字符的JSON到REDIS,但是特殊字符正在被转换
特殊字符Mój将被转换为Mç³j,而Můj将被转换为M?j
from rejson import Client, Path
import json
rj = Client(host='localhost', port=6360, decode_responses=True)
app_details2 = {
"applist": [
{
"appname": "Mój",
"country": "PL"
},
{
"appname": "Můj",
"country": "CZ"
}
],
"lasttimestamp": "2021-01-03 12:58:26",
"loadtype":"F"
}
rj.jsonset('app_details', Path.rootPath(),app_details)
valo = rj.jsonget('app_details',Path('.applist'))
print(type(valo[0]))
print(valo)
for i in valo:
app = i["appname"]
country = i["country"]
print(app)
发布于 2021-01-29 15:39:37
通过向JSONGET添加额外的参数解决了该问题
valo = rj.jsonget('app_details',Path('.applist'),no_escape=True)
这解决了问题,数据可以正确获取
https://stackoverflow.com/questions/65950249
复制相似问题