googleapis / googleapis/google-cloud-python

Support UTF-8 data in `JsonProperty`

Đang mở
#15,830 1 bình luận 0 reaction 1 người được giao Được @daniel-sanche nhận Xem trên GitHub
api: datastore priority: p3 type: feature request
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.