Commit f7ad4393 authored by Simon Marlow's avatar Simon Marlow
Browse files

add utf8_bom codec

parent df3adad5
......@@ -29,5 +29,8 @@ utf32le-test: utf8-test
utf32be-test: utf8-test
iconv -f UTF8 -t UTF32BE <utf8-test >utf32be-test
hSetEncoding001.in : latin1 utf8-test utf16le-test utf16be-test utf16-test utf32le-test utf32be-test utf32-test
cat >$@ latin1 utf8-test utf16le-test utf16be-test utf16-test utf32-test utf32le-test utf32be-test
utf8-bom-test: utf16-test
iconv -f UTF16LE -t UTF8 <utf16-test >utf8-bom-test
hSetEncoding001.in : latin1 utf8-test utf16le-test utf16be-test utf16-test utf32le-test utf32be-test utf32-test utf8-bom-test
cat >$@ latin1 utf8-test utf16le-test utf16be-test utf16-test utf32-test utf32le-test utf32be-test utf8-bom-test
......@@ -11,6 +11,7 @@ import System.Exit
file = "encoding001"
encodings = [(utf8, "utf8"),
(utf8_bom,"utf8_bom"),
(utf16, "utf16"),
(utf16le,"utf16le"),
(utf16be,"utf16be"),
......
......@@ -39,6 +39,9 @@ test file buf = do
hSetEncoding h utf32be
putStrLn "UTF32BE:"
getUntilX h
hSetEncoding h utf8_bom
putStrLn "UTF8-BOM:"
getUntilX h
hIsEOF h >>= print
getUntilX h = do
......
......@@ -24,6 +24,9 @@ UTF32LE:
UTF32BE:
(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
𝑎𝑏𝑐𝑑𝑒𝑓𝑔𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧
UTF8-BOM:
(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
𝑎𝑏𝑐𝑑𝑒𝑓𝑔𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧
True
no encoding:
c0 | À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï
......@@ -51,6 +54,9 @@ UTF32LE:
UTF32BE:
(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
𝑎𝑏𝑐𝑑𝑒𝑓𝑔𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧
UTF8-BOM:
(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
𝑎𝑏𝑐𝑑𝑒𝑓𝑔𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧
True
no encoding:
c0 | À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï
......@@ -78,4 +84,7 @@ UTF32LE:
UTF32BE:
(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
𝑎𝑏𝑐𝑑𝑒𝑓𝑔𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧
UTF8-BOM:
(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
𝑎𝑏𝑐𝑑𝑒𝑓𝑔𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧
True
Supports Markdown
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