You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Method to_structured can't control NON-ASCII chars #206
Could anyone take a look at this? It would be nice to be able to pass a parameter like ensure_ascii=False on the methods serializing the cloud events into a JSON format.
OK, this is unfortunately not possible right now as well as it is not possible to modify any JSON-related conversions.
I'd very much like to support ensure_ascii, but it will also require support for all the other possible parameters. And also this kinda forces both producer and consumer to be aware of ASCII encoding while in Python at least json.dumps and json.loads have ensure_ascii=True by default.
I believe SDK should support more than just a couple of params but IDK when this can be implemented. Ideally, I'd like to provide a way to just supply custom to_json and from_json implementations throughout the whole SDK. This allows for achieving any required flexibility.
@xSAVIKx I am interested in working on this issue, and I am trying to understand it a little better.
In the comment above, you mentioned that it would be ideal to have a custom to_json, and from_json implementation throughout the whole SDK. However, in the link below, doesn't the data_marshaller parameter act as a custom implementation?
Activity
pcaldeira-md commentedon Dec 12, 2022
Could anyone take a look at this? It would be nice to be able to pass a parameter like
ensure_ascii=Falseon the methods serializing the cloud events into a JSON format.xSAVIKx commentedon Dec 12, 2022
Hey, sorry, I seemed to miss this one. I'll try to spend some time over the next couple of days, but no ETA. PRs are very welcome though :-)
pcaldeira-md commentedon Dec 12, 2022
Great, thanks! 🙏
xSAVIKx commentedon Dec 15, 2022
OK, this is unfortunately not possible right now as well as it is not possible to modify any JSON-related conversions.
I'd very much like to support
ensure_ascii, but it will also require support for all the other possible parameters. And also this kinda forces both producer and consumer to be aware of ASCII encoding while in Python at leastjson.dumpsandjson.loadshaveensure_ascii=Trueby default.I believe SDK should support more than just a couple of params but IDK when this can be implemented. Ideally, I'd like to provide a way to just supply custom
to_jsonandfrom_jsonimplementations throughout the whole SDK. This allows for achieving any required flexibility.MaryamTaj commentedon Nov 26, 2023
@xSAVIKx I am interested in working on this issue, and I am trying to understand it a little better.
In the comment above, you mentioned that it would be ideal to have a custom to_json, and from_json implementation throughout the whole SDK. However, in the link below, doesn't the data_marshaller parameter act as a custom implementation?
sdk-python/cloudevents/conversion.py
Line 62 in 21572af