Restore tests for Unicode decoding within ``enumHandle``.
diff --git a/enumerator.cabal b/enumerator.cabal
index b1c1179..50c3c5b 100644
--- a/enumerator.cabal
+++ b/enumerator.cabal
@@ -69,6 +69,8 @@
   tests/enumerator-tests.cabal
   tests/data/ascii-crlf.txt
   tests/data/ascii-lf.txt
+  tests/data/utf8-crlf.txt
+  tests/data/utf8-lf.txt
   tests/EnumeratorTests.hs
   tests/EnumeratorTests/Binary.hs
   tests/EnumeratorTests/Binary/Consume.hs
diff --git a/tests/EnumeratorTests/Text/Handle.hs b/tests/EnumeratorTests/Text/Handle.hs
index 9b18961..3905703 100644
--- a/tests/EnumeratorTests/Text/Handle.hs
+++ b/tests/EnumeratorTests/Text/Handle.hs
@@ -7,18 +7,20 @@
 -- See license.txt for details
 module EnumeratorTests.Text.Handle
 	( test_EnumHandle
-	, test_IterHandle
 	, test_EnumFile
+	, test_IterHandle
 	) where
 
 import           Test.Chell
 
 #ifdef MIN_VERSION_knob
 import           Data.Knob
+#else
+import           EnumeratorTests.Util (todo)
 #endif
 
 import           Control.Monad.IO.Class (liftIO)
-import           Data.Text (Text)
+import           Data.Text (Text, replace)
 import qualified System.IO as IO
 
 import qualified Data.Enumerator as E
@@ -28,48 +30,15 @@
 
 import           Paths_enumerator_tests (getDataFileName)
 
-#ifdef MIN_VERSION_knob
-
 test_EnumHandle :: Suite
-test_EnumHandle = assertions "enumHandle" $ do
-	do
-		knob <- newKnob "0123\n\n4567"
-		chunks <- withFileHandle knob "" IO.ReadMode $ \h -> do
-			E.run_ (ET.enumHandle h $$ EL.consume)
-		$expect (equal chunks ["0123\n", "\n", "4567"])
-	do
-		knob <- newKnob "0123\r\n\n4567\r\n"
-		chunks <- withFileHandle knob "" IO.ReadMode $ \h -> do
-			E.run_ (ET.enumHandle h $$ EL.consume)
-		$expect (equal chunks ["0123\r\n", "\n", "4567\r\n"])
+test_EnumHandle = suite "enumHandle"
+	[ test_EnumHandle_AsciiLF
+	, test_EnumHandle_AsciiCRLF
+	, test_EnumHandle_Utf8LF
+	, test_EnumHandle_Utf8CRLF
+	]
 
-test_IterHandle :: Suite
-test_IterHandle = assertions "iterHandle" $ do
-	knob <- newKnob ""
-	withFileHandle knob "" IO.WriteMode $ \h -> do
-		E.run_ (E.enumLists [[], ["A", "B"], ["C"]] $$ ET.iterHandle h)
-	bytes <- Data.Knob.getContents knob
-	$expect (equal bytes "ABC")
-
-#else
-
-import           EnumeratorTests.Util (todo)
-
-test_EnumHandle :: Suite
-test_EnumHandle = todo "enumHandle"
-
-test_IterHandle :: Suite
-test_IterHandle = todo "iterHandle"
-
-#endif
-
-lines_LF :: [Text]
-lines_LF = ["hello\n", "\n", "world\n"]
-
-lines_CRLF :: [Text]
-lines_CRLF = ["hello\r\n", "\r\n", "world\r\n"]
-
--- define locally, because it's not present in GHC 6.10
+--- define locally, because it's not present in GHC 6.10
 data Newline = LF | CRLF
 	deriving (Show, Eq)
 
@@ -86,15 +55,95 @@
 #endif
 #endif
 
+runEnumHandle :: String -> Assertions [Text]
+runEnumHandle name = do
+	path <- liftIO (getDataFileName name)
+	chunks <- liftIO (IO.withFile path IO.ReadMode (\h -> do
+#if MIN_VERSION_base(4,2,0)
+		IO.hSetEncoding h IO.utf8
+#endif
+		E.run_ (ET.enumHandle h $$ EL.consume)))
+	return chunks
+
+test_EnumHandle_AsciiLF :: Suite
+test_EnumHandle_AsciiLF = assertions "ascii-lf" $ do
+	chunks <- runEnumHandle "data/ascii-lf.txt"
+	$expect (equalItems
+		[ "hello\n"
+		, "\n"
+		, "world\n"
+		] chunks)
+
+test_EnumHandle_AsciiCRLF :: Suite
+test_EnumHandle_AsciiCRLF = assertions "ascii-crlf" $ do
+	chunks <- runEnumHandle "data/ascii-crlf.txt"
+	let rawLines =
+		[ "hello\r\n"
+		, "\r\n"
+		, "world\r\n"
+		]
+	let expected = case nativeNewline of
+		CRLF -> map (replace "\r\n" "\n") rawLines
+		LF -> rawLines
+	$expect (equalItems expected chunks)
+
+test_EnumHandle_Utf8LF :: Suite
+test_EnumHandle_Utf8LF = assertions "utf8-lf" $ do
+	chunks <- runEnumHandle "data/utf8-lf.txt"
+	$expect (equalItems
+		[ "hello world\n"
+		, "\n"
+		, "\20320\22909\19990\30028\n"
+		, "\n"
+		, "\1605\1585\1581\1576\1575 \1575\1604\1593\1575\1604\1605\n"
+		, "\n"
+		, "\12371\12435\12395\12385\12399\19990\30028\n"
+		, "\n"
+		, "\2997\2979\2965\3021\2965\2990\3021\n"
+		] chunks)
+
+test_EnumHandle_Utf8CRLF :: Suite
+test_EnumHandle_Utf8CRLF = assertions "utf8-crlf" $ do
+	chunks <- runEnumHandle "data/utf8-crlf.txt"
+	let rawLines =
+		[ "hello world\r\n"
+		, "\r\n"
+		, "\20320\22909\19990\30028\r\n"
+		, "\r\n"
+		, "\1605\1585\1581\1576\1575 \1575\1604\1593\1575\1604\1605\r\n"
+		, "\r\n"
+		, "\12371\12435\12395\12385\12399\19990\30028\r\n"
+		, "\r\n"
+		, "\2997\2979\2965\3021\2965\2990\3021\r\n"
+		]
+	let expected = case nativeNewline of
+		CRLF -> map (replace "\r\n" "\n") rawLines
+		LF -> rawLines
+	$expect (equalItems expected chunks)
+
 test_EnumFile :: Suite
 test_EnumFile = assertions "enumFile" $ do
-	do
-		path <- liftIO (getDataFileName "data/ascii-lf.txt")
-		chunks <- liftIO (E.run_ (ET.enumFile path $$ EL.consume))
-		$expect (equal chunks lines_LF)
-	do
-		path <- liftIO (getDataFileName "data/ascii-crlf.txt")
-		chunks <- liftIO (E.run_ (ET.enumFile path $$ EL.consume))
-		$expect (equal chunks (case nativeNewline of
-			LF -> lines_CRLF
-			CRLF -> lines_LF))
+	path <- liftIO (getDataFileName "data/ascii-lf.txt")
+	chunks <- liftIO (E.run_ (ET.enumFile path $$ EL.consume))
+	$expect (equal
+		[ "hello\n"
+		, "\n"
+		, "world\n"
+		] chunks)
+
+#ifdef MIN_VERSION_knob
+
+test_IterHandle :: Suite
+test_IterHandle = assertions "iterHandle" $ do
+	knob <- newKnob ""
+	withFileHandle knob "" IO.WriteMode $ \h -> do
+		E.run_ (E.enumLists [[], ["A", "B"], ["C"]] $$ ET.iterHandle h)
+	bytes <- Data.Knob.getContents knob
+	$expect (equal bytes "ABC")
+
+#else
+
+test_IterHandle :: Suite
+test_IterHandle = todo "iterHandle"
+
+#endif
diff --git a/tests/data/utf8-crlf.txt b/tests/data/utf8-crlf.txt
new file mode 100644
index 0000000..91e2a6d
--- /dev/null
+++ b/tests/data/utf8-crlf.txt
@@ -0,0 +1,9 @@
+hello world

+

+你好世界

+

+مرحبا العالم

+

+こんにちは世界

+

+வணக்கம்

diff --git a/tests/data/utf8-lf.txt b/tests/data/utf8-lf.txt
new file mode 100644
index 0000000..70a78e0
--- /dev/null
+++ b/tests/data/utf8-lf.txt
@@ -0,0 +1,9 @@
+hello world
+
+你好世界
+
+مرحبا العالم
+
+こんにちは世界
+
+வணக்கம்
diff --git a/tests/enumerator-tests.cabal b/tests/enumerator-tests.cabal
index 823ccf5..517a004 100644
--- a/tests/enumerator-tests.cabal
+++ b/tests/enumerator-tests.cabal
@@ -6,6 +6,8 @@
 data-files:
   data/ascii-crlf.txt
   data/ascii-lf.txt
+  data/utf8-crlf.txt
+  data/utf8-lf.txt
 
 flag coverage
   default: False