Skip to content

Incorrect result for decodeUtf8 of "\194" ByteString with text 1.0 #61

@snoyberg

Description

@snoyberg

Consider the following code:

{-# LANGUAGE OverloadedStrings #-}

import qualified Data.Text.IO as TIO
import Data.Text.Encoding (decodeUtf8)

main :: IO ()
main = TIO.putStrLn $ decodeUtf8 "\194"

The behavior with text pre-1.0, and the expected behavior, is that it throws an exception, in particular:

text-bug.hs: Cannot decode byte '\xc2': Data.Text.Encoding.decodeUtf8: Invalid UTF-8 stream

Beginning with release 1.0, this prints out an empty string. This behavior was initially reported as a bug in conduit's text decoding at snoyberg/conduit#127.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions