Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix compiler support for unicode strings #10 #21

Merged
merged 1 commit into from

2 participants

@Gozala

Fix for #10

@Gozala

This fixes #10 by using js specific functionality instead of fixing format function. For the later one I have created #20 but not really sure how important is it to match java format API.

@kanaka kanaka merged commit bd8a4cd into kanaka:cljs_in_cljs
@kanaka
Owner

At least for now, I think that's fine. I'm not sure where string formatting would fall on the "native integration" -> "common interface" continuum.

@Gozala Gozala deleted the Gozala:bug/unicode branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 20, 2013
  1. @Gozala
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +2 −1  src/cljs/cljs/compiler.cljs
  2. +2 −0  test/cljs/cljs/quick.cljs
View
3  src/cljs/cljs/compiler.cljs
@@ -116,7 +116,8 @@
9 "\\t"
(if (< 31 cp 127)
c ; Print simple ASCII characters
- (format "\\u%04X" cp))))) ; Any other character is Unicode
+ ; Any other character is Unicode
+ (apply str "\\u" (take-last 4 (str "0000" (.toString cp 16))))))))
(defn- escape-pattern [^String pattern]
(-> pattern
View
2  test/cljs/cljs/quick.cljs
@@ -45,6 +45,8 @@
(assert (= '(3 6 9 12) (seq (let [a (array 1 2 3 4)] (amap a i ret (* 3 (aget a i)))))))
(assert (= 25 (let [a (array 1 2 3 4 5)] (areduce a i ret 10 (+ ret (aget a i))))))
+ ;; unicode
+ (assert (= "ü" "\u00fc") "unicodes are read properly")
;; Macros
(assert (= 5 (quick-mac 5)))
Something went wrong with that request. Please try again.