[Pkg-javascript-commits] [sockjs-client] 208/434: Make sure there are no raw unicode characters in generated minified javascript
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:14 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository sockjs-client.
commit 6b1fc2519c93df675ceb192264531e8fd4f51d85
Author: Marek Majkowski <majek04 at gmail.com>
Date: Fri Nov 25 16:23:50 2011 +0000
Make sure there are no raw unicode characters in generated minified javascript
---
bin/render.coffee | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/bin/render.coffee b/bin/render.coffee
index 16f227b..4f5ac7c 100644
--- a/bin/render.coffee
+++ b/bin/render.coffee
@@ -23,6 +23,13 @@ array_flatten = (arr, acc) ->
throw "Value is not an Array nor a String!"
return acc
+stringify_unicode = (str) ->
+ str = str.replace /[\u0100-\uffff]/g, (ch) ->
+ return "\\u" + ('0000' + ch.charCodeAt(0).toString(16)).substr(-4)
+ str = str.replace /[\x00-\x1f\x7f-\xff]/g, (ch) ->
+ return "\\x" + ('00' + ch.charCodeAt(0).toString(16)).substr(-2)
+ return str
+
minify = (data, minify_options)->
ast = uglify.parser.parse(data)
@@ -88,6 +95,8 @@ main = ->
content = for filename in filenames
render(filename, '', options)
content.push('\n')
- process.stdout.write(array_flatten(content).join(''), 'utf8')
+ process.stdout.write(
+ stringify_unicode(array_flatten(content).join('')),
+ 'utf8')
-main()
\ No newline at end of file
+main()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list