Skip to content

Instantly share code, notes, and snippets.

@mhuebert
Last active February 17, 2016 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhuebert/286b09f672e834fbb21d to your computer and use it in GitHub Desktop.
Save mhuebert/286b09f672e834fbb21d to your computer and use it in GitHub Desktop.
From 61bdf6adcf3b04e627616082be926eade9fe8202 Mon Sep 17 00:00:00 2001
From: Matthew Huebert <no-email@gmail.com>
Date: Wed, 17 Feb 2016 21:47:24 +0100
Subject: [PATCH] CLJS-1576: cljs.js sourcemap support throws on non-latin1
characters
Escape non-Latin1 characters before base64 encoding the source-map string.
---
src/main/cljs/cljs/js.cljs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/cljs/cljs/js.cljs b/src/main/cljs/cljs/js.cljs
index 8a1e42c..a68f0c9 100644
--- a/src/main/cljs/cljs/js.cljs
+++ b/src/main/cljs/cljs/js.cljs
@@ -149,7 +149,7 @@
(.append sb
(str "\n//# sourceURL=" file
"\n//# sourceMappingURL=data:application/json;base64,"
- (base64/encodeString json)))))
+ (base64/encodeString (string/replace json #"%([0-9A-F]{2})" (.fromCharCode js/String "0x$1")))))))
;; -----------------------------------------------------------------------------
;; Analyze
--
2.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment