You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Andreas Voellmy (JIRA)" <ji...@apache.org> on 2015/05/16 21:35:59 UTC

[jira] [Updated] (THRIFT-3161) Haskell only allows UTF8 encoded strings.

     [ https://issues.apache.org/jira/browse/THRIFT-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Voellmy updated THRIFT-3161:
------------------------------------

Actually, I think this is not an issue. This is resolved by using the "binary" type, which is represented in Haskell with ByteString.

Closing.

> 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)