with-utf8 1.0.2.1 → 1.0.2.2
raw patch · 3 files changed
+12/−8 lines, 3 files
Files
- app/utf8-troubleshoot/Main.hs +4/−0
- lib/System/IO/Utf8.hs +2/−2
- with-utf8.cabal +6/−6
app/utf8-troubleshoot/Main.hs view
@@ -20,7 +20,9 @@ import Data.Version (showVersion) import Foreign.C.String (CString, peekCAString) import GHC.IO.Encoding (getLocaleEncoding, initLocaleEncoding)+#if !(defined(mingw32_HOST_OS) || defined(__MINGW32__)) import GHC.IO.Encoding.Iconv (localeEncodingName)+#endif import GHC.Show (showLitString) import Language.Haskell.TH.Env (envQ) import System.Directory (doesDirectoryExist, doesPathExist, listDirectory)@@ -93,7 +95,9 @@ showCbits :: IO () showCbits = do putStrLn "# C bits"+#if !(defined(mingw32_HOST_OS) || defined(__MINGW32__)) putStrLn $ " * localeEncodingName = " <> localeEncodingName+#endif showLibcharset showLanginfoh where
lib/System/IO/Utf8.hs view
@@ -9,7 +9,7 @@ -- | -- -- Standard IO functions assume that the character encoding of the data--- they read or write is the same as the one used by current locale. In many+-- they read or write is the same as the one used by the current locale. In many -- situtations this assumption is wrong, as tools work with files, and -- files nowadays are mostly UTF-8 encoded, regardless of the locale. -- Therefore, it is almost always a good idea to switch the encoding of@@ -17,7 +17,7 @@ -- -- The same applies to standard input, output, and error handles. However, -- there is an edge-case: if they are attached to a terminal, and the--- encoding is not UTF-8, using UTF-8 might actually be unsafe.+-- current locale encoding is not UTF-8, using UTF-8 might actually be unsafe. -- -- If you are developing an executable, in most cases, it is enough to -- configure the environment accordingly on program start, see the
with-utf8.cabal view
@@ -1,25 +1,25 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.2. -- -- see: https://github.com/sol/hpack ----- hash: 2ed0a249f825ee3e79d21ffa4b3492196be09adead30d226047e943c9aa8a7a7+-- hash: 82e6b04d01f14be8fc41ce3d7271039952fa94becdc1dd8d66d99b1fa434f675 name: with-utf8-version: 1.0.2.1+version: 1.0.2.2 synopsis: Get your IO right on the first try description: This minimalistic library helps you navigate the world of text encodings avoiding @invalid argument (invalid byte sequence)@ and @invalid argument (invalid character)@ in runtime. .+ See <https://serokell.io/blog/haskell-with-utf8 this blog post> for why this+ library exists and what exactly it does.+ . The two most important modules are: . * "Main.Utf8" * "System.IO.Utf8"- .- See <https://serokell.io/blog/haskell-with-utf8 this blog post> for why this- library exists and what exactly it does. category: IO homepage: https://github.com/serokell/haskell-with-utf8#readme bug-reports: https://github.com/serokell/haskell-with-utf8/issues