-
Notifications
You must be signed in to change notification settings - Fork 199
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
should --json
output always be utf-8?
#1030
Comments
|
Everything should always be utf-8, to a first approximation. The problem is that some consoles don't support UTF8, and some consoles have a different encoding. We write String to stdout, and rely on GHC to match the encoding you asked for, which seems correct. What are your consoles set to? If went to have JSON get this right, maybe we need to supply a file argument to json, so it can put it in a file, and write that file in the only sane encoding (UTF8). |
I've seen it 3 places so far I have a sublime text plugin (python) that calls hlint with I have a terminal UI app written in rust that calls hlint as as And I've just tried running it myself in cmd in Windows 10 1909 and |
I see the environment is supposed to tell ghc what to output, and in the bash terminal I have the following which I would expect made it be utf8
|
Writing stuff to stdout by default in an encoding that stdout doesn't profess to support seems like a bad idea? Is it? Why doesn't GHC get this right? I see a few options:
|
yup. it does seem like bad idea |
well i narrowed one of them down to being ncurses needing wide characters to display utf8 correct that just leaves the default codepage being latin1 in windows which neither rust or python or very happy with i tried testing when |
maybe an interesting point here but i'm also piping in the file content and have to encode it utf8 or hlint says no. so that means when using for example in powershell when there is a lint against a unicode char
results in different output than
|
Haskell code is always assumed to be in UTF8 when in a file - I guess I should probably treat it as console locale when reading from stdin. If anyone wants to shove up a patch, then I'd accept. |
Struggling to process the json output when the hints have special characters in.
£ is going in as utf8
0xA3
but coming out when run on windows as0x9C
, a dos encoding for £, and when run on linuxM-BM-#
some escape sequence, presumably for £makes it very difficult to process the output
an aside on encoding:
invalid (i assume) hints also come out malformed
results in this weird output which i looks encoding related
The text was updated successfully, but these errors were encountered: