Commit 7658fba2 authored by Bodigrim's avatar Bodigrim
Browse files

Undeprecate decodeASCII

parent 3664d9f1
{-# LANGUAGE ForeignFunctionInterface #-}
{-# OPTIONS_GHC -fno-warn-deprecations #-}
-- | Test decoding of UTF-8
--
......
......@@ -112,7 +112,7 @@ import GHC.Stack (HasCallStack)
-- 'decodeUtf8With' allows the programmer to determine what to do on a
-- decoding error.
-- | /Deprecated/. Decode a 'ByteString' containing 7-bit ASCII
-- | Decode a 'ByteString' containing 7-bit ASCII
-- encoded text.
decodeASCII :: ByteString -> Text
decodeASCII bs = withBS bs $ \fp len -> if len == 0 then empty else runST $ do
......@@ -122,7 +122,6 @@ decodeASCII bs = withBS bs $ \fp len -> if len == 0 then empty else runST $ do
then let !(SBS.SBS arr) = SBS.toShort bs in
return (Text (A.ByteArray arr) 0 len)
else error $ "decodeASCII: detected non-ASCII codepoint at " ++ show asciiPrefixLen
{-# DEPRECATED decodeASCII "Use decodeUtf8 instead" #-}
-- | Decode a 'ByteString' containing Latin-1 (aka ISO-8859-1) encoded text.
--
......
{-# LANGUAGE BangPatterns,CPP #-}
{-# LANGUAGE Trustworthy #-}
{-# OPTIONS_GHC -fno-warn-deprecations #-}
-- |
-- Module : Data.Text.Lazy.Encoding
-- Copyright : (c) 2009, 2010 Bryan O'Sullivan
......@@ -80,11 +78,10 @@ import Data.Text.Unsafe (unsafeDupablePerformIO)
-- 'decodeUtf8With' allows the programmer to determine what to do on a
-- decoding error.
-- | /Deprecated/. Decode a 'ByteString' containing 7-bit ASCII
-- | Decode a 'ByteString' containing 7-bit ASCII
-- encoded text.
decodeASCII :: B.ByteString -> Text
decodeASCII = foldr (chunk . TE.decodeASCII) empty . B.toChunks
{-# DEPRECATED decodeASCII "Use decodeUtf8 instead" #-}
-- | Decode a 'ByteString' containing Latin-1 (aka ISO-8859-1) encoded text.
decodeLatin1 :: B.ByteString -> Text
......
-- | Tests for encoding and decoding
{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-unused-imports -fno-warn-deprecations #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
module Tests.Properties.Transcoding
( testTranscoding
) where
import Control.Applicative ((<$>), (<*>))
import Data.Bits ((.&.), shiftR)
import Data.Char (chr, ord)
import Data.Text.Encoding (encodeUtf8Builder, encodeUtf8BuilderEscaped)
import Data.Text.Encoding.Error (UnicodeException)
import Data.Text.Internal.Encoding.Utf8 (ord2, ord3, ord4)
import Test.QuickCheck hiding ((.&.))
import Test.QuickCheck.Property (Property(..))
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.QuickCheck (testProperty)
import Tests.QuickCheckUtils
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment