Closed GoogleCodeExporter closed 9 years ago
brad:~/Downloads$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3635)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)
Using OSX 10.7.3
Original comment by DunbarB2
on 2 May 2012 at 11:23
Note: This is only with --charset 'utf-8' and does not manifest when not using
that flag.
Original comment by DunbarB2
on 2 May 2012 at 11:24
Proposed fix:
diff --git a/src/com/google/javascript/jscomp/CodeGenerator.java
b/src/com/google/javascript/jscomp/CodeGenerator.java
index 4143577..49699b0 100644
--- a/src/com/google/javascript/jscomp/CodeGenerator.java
+++ b/src/com/google/javascript/jscomp/CodeGenerator.java
@@ -1019,6 +1019,8 @@ class CodeGenerator {
case '\\': sb.append(backslashEscape); break;
case '\"': sb.append(doublequoteEscape); break;
case '\'': sb.append(singlequoteEscape); break;
+ case '\u2028': sb.append("\\u2028"); break;
+ case '\u2029': sb.append("\\u2029"); break;
case '>': // Break --> into --\> or ]]> into ]]\>
if (i >= 2 &&
((s.charAt(i - 1) == '-' && s.charAt(i - 2) == '-') ||
Original comment by DunbarB2
on 2 May 2012 at 12:00
One more note: The reason for the patch is that \u2028 and \u2029 cannot be
included in javascript string literals since they are valid line terminators.
This cropped up in an issue reported to underscorejs in which a string literal
containing these was not escaped and caused a syntax error in compiled code.
Relevant links below.
http://es5.github.com/#x7.3
https://github.com/documentcloud/underscore/issues/579
Original comment by DunbarB2
on 2 May 2012 at 1:34
thanks for the report! have you filled out a CLA? see:
http://code.google.com/p/closure-compiler/source/browse/trunk/CONTRIBUTORS
Original comment by Nicholas.J.Santos
on 2 May 2012 at 6:37
I have now. :)
Original comment by DunbarB2
on 2 May 2012 at 8:36
This issue was closed by revision r1947.
Original comment by `` on 3 May 2012 at 5:57
Fantastic! Thanks Nicholas!
Original comment by DunbarB2
on 3 May 2012 at 6:17
Issue 761 has been merged into this issue.
Original comment by chadkill...@missouristate.edu
on 22 Jun 2012 at 12:15
Issue 761 has been merged into this issue.
Original comment by Nicholas.J.Santos
on 22 Jun 2012 at 3:33
Original issue reported on code.google.com by
DunbarB2
on 2 May 2012 at 11:22