HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulecode-page-0.2.1Haskell2010

System.IO.CodePage

Exports functions which adjust code pages on Windows, and do nothing on other operating systems.

  • 3 types
  • 20 values
  • Packagecode-page-0.2.1
  • Exports23
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCodePage.hs

Adjusting CodePages

8 declarations
valuewithCP65001 :: IO a -> IO a
#

Sets the code page for an action to UTF-8 as necessary.

valuewithCP1200 :: IO a -> IO a
#

Sets the code page for an action to UTF-16LE as necessary.

valuewithCP1201 :: IO a -> IO a
#

Sets the code page for an action to UTF-16BE as necessary.

valuewithCP12000 :: IO a -> IO a
#

Sets the code page for an action to UTF-32LE as necessary.

valuewithCP12001 :: IO a -> IO a
#

Sets the code page for an action to UTF-32BE as necessary.

valuewithCP1252 :: IO a -> IO a
#

Sets the code page for an action to Latin1 as necessary.

valuewithCodePage :: CodePage -> IO a -> IO a
#

Sets the code page for an action as necessary.

On operating systems besides Windows, this will make an effort to change the current TextEncoding to something that is equivalent to the supplied CodePage. Currently, the only supported CodePages on non-Windows OSes are cp65001, cp1200, cp1201, cp12000, and cp12001. Supplying any other CodePage will result in a runtime error on non-Windows OSes. (If you would like to configure this behavior, use withCodePageOptions instead.)

Notable CodePages

7 declarations
typetype CodePage = Word32
#

A numeric type representing Windows code pages.

Options

2 declarations
datadata Options
#

Options that specify how withCodePage and friends should work.

Record fields of Options

valuechatty :: Options -> Bool
#

If True, emit a warning to stderr indicating that the code page has been changed. If False, don't emit any warnings.

NonWindowsBehavior

datadata NonWindowsBehavior
#

Specifies how withCodePage and friends should work on operating systems other than Windows.

Constructing NonWindowsBehavior