on master help sign in
Merge branch 'master' of github.com:idris-lang/Idris-dev
94074a9Edwin Brady
CHANGELOG+1
@@ -5,6 +5,7 @@ New in 0.9.16:
5* A new tactic sourceLocation that fills the current hole with the current
5* A new tactic sourceLocation that fills the current hole with the current
6 source code span, if this information is available. If not, it raises an
6 source code span, if this information is available. If not, it raises an
7 error.
7 error.
8+* Better Unicode support for the JavaScript/Node codegen
8
9
9New in 0.9.15:
10New in 0.9.15:
10--------------
11--------------
idris.cabal+2−2
@@ -804,7 +804,7 @@ Executable idris-javascript
804 , transformers
804 , transformers
805
805
806 ghc-prof-options: -auto-all -caf-all
806 ghc-prof-options: -auto-all -caf-all
807− ghc-options: -threaded -rtsopts -funbox-strict-fields
807+ ghc-options: -threaded -rtsopts -funbox-strict-fields -O2
808
808
809Executable idris-node
809Executable idris-node
810 Main-is: Main.hs
810 Main-is: Main.hs
@@ -817,4 +817,4 @@ Executable idris-node
817 , transformers
817 , transformers
818
818
819 ghc-prof-options: -auto-all -caf-all
819 ghc-prof-options: -auto-all -caf-all
820− ghc-options: -threaded -rtsopts -funbox-strict-fields
820+ ghc-options: -threaded -rtsopts -funbox-strict-fields -O2
src/IRTS/CodegenJavaScript.hs+7−4
@@ -495,13 +495,16 @@ translateChar ch
495 | '\\' <- ch = "\\\\"
495 | '\\' <- ch = "\\\\"
496 | '\"' <- ch = "\\\""
496 | '\"' <- ch = "\\\""
497 | '\'' <- ch = "\\\'"
497 | '\'' <- ch = "\\\'"
498+ | ch `elem` asciiTab = "\\u" ++ fill (showHex (ord ch) "")
498− | ch `elem` asciiTab = "\\u00" ++ fill (showHex (ord ch) "")
499+ | ord ch > 255 = "\\u" ++ fill (showHex (ord ch) "")
499 | otherwise = [ch]
500 | otherwise = [ch]
500 where
501 where
501 fill :: String -> String
502 fill :: String -> String
502− fill s = if length s == 1
503+ fill s = case length s of
504+ 1 -> "000" ++ s
505+ 2 -> "00" ++ s
503− then '0' : s
506+ 3 -> "0" ++ s
504− else s
507+ _ -> s
505
508
506 asciiTab =
509 asciiTab =
507 ['\NUL', '\SOH', '\STX', '\ETX', '\EOT', '\ENQ', '\ACK', '\BEL',
510 ['\NUL', '\SOH', '\STX', '\ETX', '\EOT', '\ENQ', '\ACK', '\BEL',