Andreas Voellmy created THRIFT-3161:
---------------------------------------
Summary: Haskell only allows UTF8 encoded strings.
Key: THRIFT-3161
URL: https://issues.apache.org/jira/browse/THRIFT-3161
Project: Thrift
Issue Type: Bug
Components: Haskell - Compiler, Haskell - Library
Affects Versions: 0.9.2
Reporter: Andreas Voellmy
It seems that not all Thrift bindings assume that strings are UTF8 encoded.
Some servers use this to pass byte arrays to a service where the bytes are not
UTF8 encoded.
On the other hand, Haskell-generated thrift APIs require Haskell Text values
for these string parameters, which are then UTF8 encoded to Lazy ByteString
values (and put into ThriftVal.TString). This means that there is no way from
the Haskell-generated bindings for a Thrift API to send non-UTF8 byte arrays to
a server.
I see two options:
(1) Change the thrift-generated bindings for an API to use Lazy ByteStrings for
String parameters rather than Text and then (obviously) no encoding needs to be
applied in the haskell generated instances. This makes it clear that any
encoding is up to the user of the Thrift library.
(2) Keep the Text parameters, but don't apply any encoding.
Option (1) seems more consistent and clear, though it would cause compile error
in existing Haskell clients.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)