Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3161

Haskell only allows UTF8 encoded strings.

    XMLWordPrintableJSON

Details

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            avoellmy Andreas Voellmy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: