Sets the code page for an action to UTF-8 as necessary.
Modulecode-page-0.2.1Haskell2010
System.IO.CodePage
Exports functions which adjust code pages on Windows, and do nothing on other operating systems.
Contents
Synopsis
- value withCP65001
- value withCP1200
- value withCP1201
- value withCP12000
- value withCP12001
- value withCP1252
- value withCodePage
- value withCodePageOptions
- type CodePage
- value cp65001
- value cp1200
- value cp1201
- value cp12000
- value cp12001
- value cp1252
- data Options
- value defaultOptions
- value chatty
- value nonWindowsBehavior
- data NonWindowsBehavior
- value nonWindowsDoNothing
- value nonWindowsFallbackCodePageEncoding
- value defaultFallbackCodePageEncoding
- Packagecode-page-0.2.1
- Exports23
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceCodePage.hs
Adjusting CodePages
Sets the code page for an action to UTF-16LE as necessary.
Sets the code page for an action to UTF-16BE as necessary.
Sets the code page for an action to UTF-32LE as necessary.
Sets the code page for an action to UTF-32BE as necessary.
Sets the code page for an action to Latin1 as necessary.
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.)
Sets the code page for an action as necessary. If the Bool argument is True,
this function will emit a warning to stderr indicating that the code page has
been changed. (withCodePage sets this argument to False.)
Notable CodePages
A numeric type representing Windows code pages.
The UTF-8 code page.
The UTF-16LE code page.
The UTF-16BE code page.
The UTF-32LE code page.
The UTF-32BE code page.
The Latin1 code page.
Options that specify how withCodePage and friends should work.
The default Options:
Options
{ chatty = False
, nonWindowsBehavior =
nonWindowsFallbackCodePageEncoding defaultFallbackCodePageEncoding
}
Record fields of Options
Configures how withCodePage and friends should work on non-Windows
operating systems.
NonWindowsBehavior
Specifies how withCodePage and friends should work on operating systems
other than Windows.
Constructing NonWindowsBehavior
Don't do anything at all on non-Windows OSes.
On non-Windows OSes, change the TextEncoding by converting the CodePage argument to a TextEncoding using the supplied function.
Provides a best-effort attempt to convert a CodePage to a TextEncoding on non-Windows OSes. Errors if given a CodePage that it doesn't know how to convert.