googleapis / googleapis/google-cloud-python

Support UTF-8 data in `JsonProperty`

未关闭
#15,830 1 条评论 0 个 reaction 已指派 1 人 已被 @daniel-sanche 认领 在 GitHub 查看
api: datastore priority: p3 type: feature request
主要语言
Python
星标
5.4k
派生
1.8k
平均合并
3 天 4 小时
30 天内合并 PR
122

描述

We have datastore entities with a property that holds JSON data. The entities itself were written using a datastore library in a different language than Python. The data includes unescaped UTF-8 characters (which should be legal in JSON, and is generally well supported).

When using an NDB `JsonProperty` to access this data from within Python, however, this breaks. This is because `JsonProperty` only supports ascii data:

```python
def _from_base_type(self, value):
if not isinstance(value, str):
value = value.decode("ascii")
return json.loads(value)
```

Could `JsonProperty` be adapted to decode `utf-8`, to have better interoperability between different languages working on the same data?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。