public
/
UglifyJS.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
69dde04
)
Output, to_ascii: Escape non-ascii chars with \xnn instead of \unnnn whenever possible.
author
Andreas Lind Petersen
<andreas@one.com>
Sun, 31 Mar 2013 09:07:31 +0000
(11:07 +0200)
committer
Mihai Bazon
<mihai@bazon.net>
Sun, 31 Mar 2013 10:36:22 +0000
(13:36 +0300)
lib/output.js
patch
|
blob
|
history
diff --git
a/lib/output.js
b/lib/output.js
index
42b3aad
..
b99bfa6
100644
(file)
--- a/
lib/output.js
+++ b/
lib/output.js
@@
-72,8
+72,13
@@
function OutputStream(options) {
function to_ascii(str) {
return str.replace(/[\u0080-\uffff]/g, function(ch) {
var code = ch.charCodeAt(0).toString(16);
- while (code.length < 4) code = "0" + code;
- return "\\u" + code;
+ if (code.length <= 2) {
+ while (code.length < 2) code = "0" + code;
+ return "\\x" + code;
+ } else {
+ while (code.length < 4) code = "0" + code;
+ return "\\u" + code;
+ }
});
};