Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Javier Neira
GHC
Commits
c3105be4
Commit
c3105be4
authored
3 years ago
by
Bodigrim
Committed by
Marge Bot
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Documentation for setLocaleEncoding
parent
ec9d7e04
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/base/GHC/IO/Encoding.hs
+27
-2
27 additions, 2 deletions
libraries/base/GHC/IO/Encoding.hs
with
27 additions
and
2 deletions
libraries/base/GHC/IO/Encoding.hs
+
27
−
2
View file @
c3105be4
...
@@ -133,10 +133,35 @@ getFileSystemEncoding :: IO TextEncoding
...
@@ -133,10 +133,35 @@ getFileSystemEncoding :: IO TextEncoding
getForeignEncoding
::
IO
TextEncoding
getForeignEncoding
::
IO
TextEncoding
{-# NOINLINE getForeignEncoding #-}
{-# NOINLINE getForeignEncoding #-}
-- | @since 4.5.0.0
-- | Set locale encoding for your program. The locale affects
setLocaleEncoding
,
setFileSystemEncoding
,
setForeignEncoding
::
TextEncoding
->
IO
()
-- how 'Char's are encoded and decoded when serialized to bytes: e. g.,
-- when you read or write files ('System.IO.readFile'', 'System.IO.writeFile')
-- or use standard input/output ('System.IO.getLine', 'System.IO.putStrLn').
-- For instance, if your program prints non-ASCII characters, it is prudent to execute
--
-- > setLocaleEncoding utf8
--
-- This is necessary, but not enough on Windows, where console is
-- a stateful device, which needs to be configured using
-- @System.Win32.Console.setConsoleOutputCP@ and restored back afterwards.
-- These intricacies are covered by
-- <https://hackage.haskell.org/package/code-page code-page> package,
-- which offers a crossplatform @System.IO.CodePage.withCodePage@ bracket.
--
-- Wrong locale encoding typically causes error messages like
-- "invalid argument (cannot decode byte sequence starting from ...)"
-- or "invalid argument (cannot encode character ...)".
--
-- @since 4.5.0.0
setLocaleEncoding
::
TextEncoding
->
IO
()
{-# NOINLINE setLocaleEncoding #-}
{-# NOINLINE setLocaleEncoding #-}
-- | @since 4.5.0.0
setFileSystemEncoding
::
TextEncoding
->
IO
()
{-# NOINLINE setFileSystemEncoding #-}
{-# NOINLINE setFileSystemEncoding #-}
-- | @since 4.5.0.0
setForeignEncoding
::
TextEncoding
->
IO
()
{-# NOINLINE setForeignEncoding #-}
{-# NOINLINE setForeignEncoding #-}
(
getLocaleEncoding
,
setLocaleEncoding
)
=
mkGlobal
initLocaleEncoding
(
getLocaleEncoding
,
setLocaleEncoding
)
=
mkGlobal
initLocaleEncoding
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment