mhuebert / maria

A ClojureScript coding environment for beginners.
https://maria.cloud
473 stars 34 forks source link

Unicode characters in strings throwing error in console (from compile / source-mapping) #57

Closed mhuebert closed 7 years ago

mhuebert commented 7 years ago

Demo: https://maria.cloud/gist/b64f221518bbc852475ee7a85a30854c

["⬆"]

Forms containing non-Latin1 characters like "⬆" (and others, haven't checked) produce errors:

base64.js:178 Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
    at Object.goog.crypt.base64.encodeString (http://0.0.0.0:5000/js/compiled/out-user-dev/goog/crypt/base64.js:178:24)
    at cljs$js$append_source_map (http://0.0.0.0:5000/js/compiled/out-user-dev/cljs/js.js:264:295)
    at cljs$js$compile_str_STAR__$_compile_loop (http://0.0.0.0:5000/js/compiled/out-user-dev/cljs/js.js:1605:27)

The error does not occur when evaluating the string "⬆" but that's due to an implementation detail in cljs-live where we don't put primitives through the compiler (they are simply read by the reader). Any time this character goes through the compiler we get the error.

This is happening during source-mapping, and looks related to this issue, which perhaps wasn't fixed entirely the first time around, or something else changed in the meantime: https://dev.clojure.org/jira/browse/CLJS-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

mhuebert commented 7 years ago

the patch has been applied to master, next cljs release this will be fixed! yay. https://clojurians.slack.com/archives/C07UQ678E/p1506870270000009