Open stamog opened 1 year ago
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.
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 :-)
Great, thanks! 🙏
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? https://github.com/cloudevents/sdk-python/blob/21572afb579df15b386461b740340ba912270dbf/cloudevents/conversion.py#L62
Expected Behavior
I am using to_structured() but there are non-ascii symbols that I want to have included. I cannot alter its behaviour.
Actual Behavior
to_structured method returns them in the form of '\u00'
Steps to Reproduce the Problem
Specifications