[
https://issues.apache.org/jira/browse/THRIFT-414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697691#action_12697691
]
Chad Walters commented on THRIFT-414:
-------------------------------------
On further reflection, I think the right thing for this patch WRT the
JSONProtocol is to use the encoding parameter instead of just assuming UTF8 --
that is, it should behave just like all the other protocols.
The problem with the JSONProtocol is that if you use a string with a non-UTF8
encoding, the wire format may not be legal JSON, since it may contain non-UTF8
bytes. Note that the protocol still functions as a protocol, in that the string
that was sent on one end with a given encoding will come out the other end in
that same encoding.
I'll still file a separate bug about the fact that the wire format of the
JSONProtocol may not always be legal JSON. If you want to leave a comment about
this somewhat undesirable feature in writeString() and readString() that would
be fine with me.
> Support non-UTF-8 in Java and C#
> --------------------------------
>
> Key: THRIFT-414
> URL: https://issues.apache.org/jira/browse/THRIFT-414
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (C#), Compiler (Cocoa), Compiler (Java),
> Library (C#), Library (Cocoa), Library (Java)
> Reporter: David Reiss
> Attachments: 0001-THRIFT-414.-Non-UTF-8-string-support-for-Java.patch
>
>
> Java and C# Thrift assume that all strings should be UTF-8. A better
> approach would be:
> - Give the readString and writeString protocol methods an encoding
> parameter, probably defaulting to UTF-8 for compatibility and convenience.
> - Make generated struct readers and writers pass the argument to the
> protocol objects for each string.
> - Allow a type annotation to override the default UTF-8 encoding.
> - All other languages (except Python 3) should ignore the annotation, but it
> will serve as documentation for the application.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.