PDA

View Full Version : Problem with UTF-8 chars with ycompressor



ssamayoa
22 Jul 2011, 8:48 PM
It seems that ycompressor assumes that my files are in cp1252 because runs in Windows but, because I share project with linux I store my source files using UTF-8.

How can I tell to ycompressor that my files are in UTF-8?

Regards.

ssamayoa
23 Jul 2011, 1:49 PM
FWIW, I changed Project.js line +/- 165 and added "--charset utf-8" to the string getCompressor() returns.

But this not solved so I also changed Target.js lines +/- 40 and 198:

var content = Fs.readFile(filePath).toString('utf-8');

With those changes (I don't know which one or both) did the trick.

Would be nice if from "sencha" command could be set the charset of the files.

Regards.

mado489
29 Feb 2012, 3:01 AM
+1

hanguokai
1 Mar 2012, 7:41 PM
I encountered the same problem, if file contain non-ascii character (eg. in string).
Another method around this problem, don't use YUICompressor with -c, like this:

sencha build -c -p app.jsb3 -d .

So the output(app-all.js) is uncompressed, and you can do this yourself. And can use any compressor like Google Closure Compiler to do this.

Nom4d3
12 Mar 2012, 10:48 AM
FWIW, I changed Project.js line +/- 165 and added "--charset utf-8" to the string getCompressor() returns.

But this not solved so I also changed Target.js lines +/- 40 and 198:

var content = Fs.readFile(filePath).toString('utf-8');

With those changes (I don't know which one or both) did the trick.

Would be nice if from "sencha" command could be set the charset of the files.

Regards.

Only changing the Project.js solved my UTF-8 problem.

prabhat2486
12 Mar 2012, 6:19 PM
Dear All,

Will you please help me as well. I am facing same problem in this.

I am invoking JsBuilder2.main method programmatic and getting the same problem. what change i need to apply.

Thanks

kinestetic
4 Sep 2012, 3:22 AM
Works for me:
Project.js line 165


Project = Ext.extend(Object, {
constructor : function(projectFile, builder) {

},
//Adding -Dfile.encoding=UTF-8 key
getCompressor : function() {
return 'java -Dfile.encoding=UTF-8 -jar "' + system.script.replace(Fs.getPath('bin/JSBuilder.js'), '') + Fs.getPath('ycompressor/ycompressor.jar') + '" --type js ';
},
..........
})

ilacyero
27 Nov 2012, 4:59 AM
De gran ayuda el codigo qu has mostrado.
Muchas gracias.