Skip to content

Open package.toml file with UTF8 locale #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@ Version 0.4.2

To be released.

### Language

- Fixed a bug that package.toml file had been failed to load when the system
locale does not use UTF-8. It's now independent from the system locale
settings.
[[#290], [#322]]

### Et cetera

- The official Docker image repository was moved to
[nirumlang/nirum](https://hub.docker.com/r/nirumlang/nirum/)
(from [spoqa/nirum](https://hub.docker.com/r/spoqa/nirum/)).

[#290]: https://github.com/nirum-lang/nirum/issues/290
[#322]: https://github.com/nirum-lang/nirum/pull/322


Version 0.4.1
-------------
Expand Down
5 changes: 4 additions & 1 deletion src/Nirum/Package/Metadata.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import Data.Text (Text, append, snoc, unpack)
import Data.Text.Encoding (encodeUtf8)
import qualified Data.Text.IO as TIO
import System.FilePath ((</>))
import System.IO
import Text.Email.Parser (EmailAddress)
import qualified Text.Email.Validate as EV
import Text.InterpolatedString.Perl6 (qq)
Expand Down Expand Up @@ -213,7 +214,9 @@ parseMetadata metadataPath' tomlText = do

readMetadata :: Target t => FilePath -> IO (Either MetadataError (Metadata t))
readMetadata metadataPath' = do
tomlText <- TIO.readFile metadataPath'
h <- openFile metadataPath' ReadMode
hSetEncoding h utf8
tomlText <- TIO.hGetContents h
return $ parseMetadata metadataPath' tomlText

metadataPath :: FilePath -> FilePath
Expand Down