Hello community, here is the log from the commit of package ghc-conduit-extra for openSUSE:Factory checked in at 2015-06-09 08:49:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-conduit-extra (Old) and /work/SRC/openSUSE:Factory/.ghc-conduit-extra.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-conduit-extra" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-conduit-extra/ghc-conduit-extra.changes 2015-05-21 08:34:30.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-conduit-extra.new/ghc-conduit-extra.changes 2015-06-09 08:50:24.000000000 +0200 @@ -1,0 +2,6 @@ +Sun May 31 20:31:58 UTC 2015 - [email protected] + +- update to 1.1.9 +* detectUtf + +------------------------------------------------------------------- Old: ---- conduit-extra-1.1.8.tar.gz New: ---- conduit-extra-1.1.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-conduit-extra.spec ++++++ --- /var/tmp/diff_new_pack.U3rfaS/_old 2015-06-09 08:50:25.000000000 +0200 +++ /var/tmp/diff_new_pack.U3rfaS/_new 2015-06-09 08:50:25.000000000 +0200 @@ -21,7 +21,7 @@ %bcond_with tests Name: ghc-conduit-extra -Version: 1.1.8 +Version: 1.1.9 Release: 0 Summary: Batteries included conduit: adapters for common libraries License: MIT ++++++ conduit-extra-1.1.8.tar.gz -> conduit-extra-1.1.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conduit-extra-1.1.8/ChangeLog.md new/conduit-extra-1.1.9/ChangeLog.md --- old/conduit-extra-1.1.8/ChangeLog.md 2015-05-12 09:11:41.000000000 +0200 +++ new/conduit-extra-1.1.9/ChangeLog.md 2015-05-27 12:40:54.000000000 +0200 @@ -1,3 +1,7 @@ +## 1.1.9 + +* detectUtf [#217](https://github.com/snoyberg/conduit/pull/217) + ## 1.1.8 * Adding buffer size to sourceHandleRange [#213](https://github.com/snoyberg/conduit/pull/213) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conduit-extra-1.1.8/Data/Conduit/Text.hs new/conduit-extra-1.1.9/Data/Conduit/Text.hs --- old/conduit-extra-1.1.8/Data/Conduit/Text.hs 2015-05-12 09:11:41.000000000 +0200 +++ new/conduit-extra-1.1.9/Data/Conduit/Text.hs 2015-05-27 12:40:54.000000000 +0200 @@ -35,6 +35,7 @@ , Data.Conduit.Text.decodeUtf8 , decodeUtf8Lenient , encodeUtf8 + , detectUtf ) where import qualified Prelude @@ -459,3 +460,34 @@ encodeUtf8 :: Monad m => Conduit T.Text m B.ByteString encodeUtf8 = CL.map TE.encodeUtf8 {-# INLINE encodeUtf8 #-} + +-- | Automatically determine which UTF variant is being used. This function +-- checks for BOMs, removing them as necessary. It defaults to assuming UTF-8. +-- +-- Since 1.1.9 +detectUtf :: MonadThrow m => Conduit B.ByteString m T.Text +detectUtf = + go id + where + go front = await >>= maybe (close front) (push front) + + push front bs' + | B.length bs < 4 = go $ B.append bs + | otherwise = leftDecode bs + where bs = front bs' + + close front = leftDecode $ front B.empty + + leftDecode bs = leftover bsOut >> decode codec + where + bsOut = B.append (B.drop toDrop x) y + (x, y) = B.splitAt 4 bs + (toDrop, codec) = + case B.unpack x of + [0x00, 0x00, 0xFE, 0xFF] -> (4, utf32_be) + [0xFF, 0xFE, 0x00, 0x00] -> (4, utf32_le) + 0xFE : 0xFF: _ -> (2, utf16_be) + 0xFF : 0xFE: _ -> (2, utf16_le) + 0xEF : 0xBB: 0xBF : _ -> (3, utf8) + _ -> (0, utf8) -- Assuming UTF-8 +{-# INLINE detectUtf #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conduit-extra-1.1.8/conduit-extra.cabal new/conduit-extra-1.1.9/conduit-extra.cabal --- old/conduit-extra-1.1.8/conduit-extra.cabal 2015-05-12 09:11:41.000000000 +0200 +++ new/conduit-extra-1.1.9/conduit-extra.cabal 2015-05-27 12:40:54.000000000 +0200 @@ -1,5 +1,5 @@ Name: conduit-extra -Version: 1.1.8 +Version: 1.1.9 Synopsis: Batteries included conduit: adapters for common libraries. Description: The conduit package itself maintains relative small dependencies. The purpose of this package is to collect commonly used utility functions wrapping other library dependencies, without depending on heavier-weight dependencies. The basic idea is that this package should only depend on haskell-platform packages and conduit.
