|
Odd. Are you sure all your encodings are correct? The -enc:in and -enc:out switches
should set the default input and output encodings for the files specified in your XML input file. In addition, each <output> and <input> element can contain their own overrides for the their individual encodings using the
encoding attribute. So I created this file and saved it in
BIG5 encoding:
// xmlinput1.js
// use BIG5 encoding
var
nihao =
"你好。";
And this file, saved as KOI8-R:
// xmlinput2.js
// use KOI8-R (Cyrillic)
var
рон =
"Меня зовут Рон.";
Then I used this as my XML input file:
<?xml
version="1.0"
encoding="utf-8"?>
<root>
<output
encoding="utf-8"
path="xmloutput.js">
<input
path="xmlinput1.js"/>
<input
path="xmlinput2.js"/>
</output>
</root>
When I just run ajaxmin -xml xmlinput.xml -clobber
(with no encoding parameters), the xmloutput.js file is all horked. If I pass
-enc:in koi-8, the Russian file decodes properly but the Chinese file does not; when I pass
-enc:in big5, the Chinese files decodes properly, but the Russian file doesn't. And if I change the XML to be this:
<?xml
version="1.0"
encoding="utf-8"?>
<root>
<output
encoding="utf-8"
path="xmloutput.js">
<input
path="xmlinput1.js"
encoding="big5"/>
<input
path="xmlinput2.js"
encoding="koi8-r"/>
</output>
</root>
They both encode properly, no matter what I use for the value of the command line -enc:in switch.
And as a side note, if I change the encoding
attribute on my <output> element to "ascii" I get properly escaped JavaScript from the properly decoded input files:
var nihao="\u4f60\u597d\u3002";var
\u0440\u043e\u043d="\u041c\u0435\u043d\u044f
\u0437\u043e\u0432\u0443\u0442 \u0420\u043e\u043d."
|