Google Closure Compiler returning in different encoding?

Google Closure Compiler returns the following code:

{"compiledCode":"vaporize\u003dfunction(){var a\u003d12+Math.random()*10;a\u003e9\u0026\u0026console.log(\"wow, k is bigger than j\");return 9+3*a};compilation_level\u003dADVANCED_OPTIMIZATIONS;vaporize\u003dfunction(){var a\u003d12+Math.random()*10;a\u003e9\u0026\u0026console.log(\"wow, k is bigger than j\");return 9+3*a};"}

It replaced (I think) equal signs with \u003d and some other stuff. What's wrong ?

My post variables are: 'compilation_level' :

'ADVANCED_OPTIMIZATIONS',  
'output_format': 'json',
'warning_level' : 'QUIET',
'output_info' : 'compiled_code',
'js_code' : code

Edit1: Only if I set 'output_format' : 'text' the encoding comes out right.

Upvotes: 2

Views: 867

Answers (1)

bobince
bobince

Reputation: 536539

It replaced (I think) equal signs with \u003d and some other stuff. What's wrong ?

Nothing. "\u003d" is a valid JavaScript (or, here, JSON) representation of a string containing an equals character; it is completely equivalent to "=".

What are you doing with the output to make it matter? If you don't want JSON output, you should indeed ask for raw ‘text’.

Upvotes: 1

Related Questions