Skip to content

Conversation

@jneira
Copy link
Member

@jneira jneira commented Jan 28, 2020

  • In windows hPutStr uses by default, the default system encoding to write content
    • In windows almost never is utf8 (in unix and macos is)
  • This make that utf8 original content are being writed incorrectly in the vfs temp file
  • AFAIK all haskell-lsp clients are assuming that contents must be in utf8
    • f.e. hlint do it
    • if it is no the case we should save, or guess(?), the original file encoding
      • or convert the original encoding to utf8 in clients
  • It hopefully closes Lint error: hGetContents: invalid argument (invalid byte sequence) (Win10 + Atom) haskell-ide-engine#1560

@jneira jneira requested review from alanz and cocreature January 28, 2020 11:47
@jneira
Copy link
Member Author

jneira commented Jan 28, 2020

The JSON spec says:

JSON text SHALL be encoded in UTF-8, UTF-16, or UTF-32. The default encoding is UTF-8, ...

So being the lsp data format json, afaiu this only would break clients that are using UTF-16 or UTF-32

Copy link
Contributor

@cocreature cocreature left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me. We don’t use the temp files at all in ghcide so this doesn’t affect us directly.

@alanz alanz merged commit 14f55c5 into haskell:master Jan 28, 2020
@jneira jneira deleted the vfs-force-utf8 branch February 5, 2020 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lint error: hGetContents: invalid argument (invalid byte sequence) (Win10 + Atom)

4 participants