caofangkun / closure-templates

Automatically exported from code.google.com/p/closure-templates
Apache License 2.0
0 stars 0 forks source link

soyutils_usegoog.js breaks using Closure Compiler flag --charset UTF-8 #52

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Generate closure templates using flags --cssHandlingScheme GOOG 
--shouldGenerateJsdoc --shouldProvideRequireSoyNamespaces
2. Build project with Closure Compiler flag --charset UTF-8 (recommend 
--compilation_level SIMPLE_OPTIMIZATIONS) and ensure soyutils_usegoog.js is 
included in the JavaScript sources

3.Open the application in Chrome or Firefox 

What is the expected output?

No errors.

What do you see instead?

In Chrome Developer Tools: Uncaught SyntaxError: Unexpected token ,
at the line defining 
soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSP
ACE__AND__NORMALIZE_HTML_NOSPACE_

What version of the product are you using? On what operating system?

Closure Templates r23 (10/25/2011)
Closure Compiler r1660 (12/02/2011)
Operating System: Linux Ubuntu 11.10

Please provide any additional information below.

The JavaScript object literal keys in 
soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSP
ACE__AND__NORMALIZE_HTML_NOSPACE_ are converted to their UTF-8 binary 
equivalents. Non-print Unicode values used as object keys (such as "\u2028") do 
not appear to be valid JavaScript when loaded in their UTF-8 equivalents, even 
when setting the HTML script tag attribute charset="UTF-8".  

Original issue reported on code.google.com by cpeis...@gmail.com on 11 Dec 2011 at 2:44

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Based on testing, this issue appears to have been fixed by Closure Compiler 
revision r1947:

http://code.google.com/p/closure-compiler/source/detail?r=1947

Note: the HTML <script> "charset" attribute must be specified.
<script charset="UTF-8" src="myscripts.js"></script>

Original comment by cpeis...@gmail.com on 22 Jun 2012 at 7:56

GoogleCodeExporter commented 8 years ago

Original comment by brendan....@gmail.com on 27 Feb 2015 at 12:21