Skip to content
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

Set the handles used for --client to use UTF-8 #1334

Merged
merged 1 commit into from
Jul 1, 2014

Conversation

Melvar
Copy link
Collaborator

@Melvar Melvar commented Jun 26, 2014

Previously they were binary-mode, so they used char8 “encoding”, taking
codepoint values modulo 256, leading to cryptic identifier mangling errors
when using idris-vim.

Previously they were binary-mode, so they used char8 “encoding”, taking
codepoint values modulo 256, leading to cryptic identifier mangling errors
when using idris-vim.
@@ -151,6 +151,7 @@ startServer orig fn_in = do tid <- runIO $ forkOS serverLoop

loop fn ist sock
= do (h,_,_) <- accept sock
hSetEncoding h utf8
cmd <- hGetLine h
Copy link
Contributor

Choose a reason for hiding this comment

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

I was going through and replacing readFiles, writeFiles, hGetLines, and hPutStrLn with versions from System.IO.UTF8
for #94.
Would you think these lines should also get similiar treatment, or the hSetEncoding calls, or both?
Speaking of things to cat set on a handle - I was wondering if LineBuffering mode should be set, or what the default is?

LeifW added a commit to LeifW/Idris-dev that referenced this pull request Jul 1, 2014
Replaced all usages of readFile, writeFile, hGetLine, and hPutStrLn from
Prelude with versions from
[System.IO.UTF8](http://hackage.haskell.org/package/utf8-string-0.3.8/docs/System-IO-UTF8.html)

Fixes idris-lang#94

Tested with `export LANG=C`. Was able to load a unicode-containing .idr
file, compile and run it, use interactive vim stuff like
case-splitting and proof search, and could also :addproof from the repl.

Technically, only the change to readFile in Idris/Chaser.hs is necessary
to fix idris-lang#94.  The rest are mainly for consistency.  I am a little leary
of changing the output encoding to unicode when the system encoding
might not be that on the things that don't deal with idris code, e.g.
the .c, .java, .pom, etc output files, that are then run through gcc,
javac, whatever.

Also, this might address the issue fixed by idris-lang#1334, and make idris-lang#1334
redunant?
edwinb added a commit that referenced this pull request Jul 1, 2014
Set the handles used for --client to use UTF-8
@edwinb edwinb merged commit f60626f into idris-lang:master Jul 1, 2014
@Melvar Melvar deleted the fix-ipc-enc branch July 1, 2014 13:26
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.

3 participants