1. #1
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,305
    Vote Rating
    108
    ssamayoa is just really nice ssamayoa is just really nice ssamayoa is just really nice ssamayoa is just really nice

      0  

    Default Problem with UTF-8 chars with ycompressor

    Problem with UTF-8 chars with ycompressor


    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.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  2. #2
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,305
    Vote Rating
    108
    ssamayoa is just really nice ssamayoa is just really nice ssamayoa is just really nice ssamayoa is just really nice

      0  

    Default


    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.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  3. #3
    Sencha User
    Join Date
    Sep 2008
    Posts
    24
    Vote Rating
    0
    mado489 is on a distinguished road

      0  

    Default


    +1

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    6
    Vote Rating
    2
    hanguokai is on a distinguished road

      0  

    Default


    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.

  5. #5
    Sencha User Nom4d3's Avatar
    Join Date
    Sep 2008
    Location
    Araras / SP / Brazil
    Posts
    81
    Vote Rating
    1
    Nom4d3 is on a distinguished road

      0  

    Default


    Quote Originally Posted by ssamayoa View Post
    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.

  6. #6
    Sencha User prabhat2486's Avatar
    Join Date
    Apr 2010
    Location
    Sydney, Australia
    Posts
    39
    Vote Rating
    0
    prabhat2486 is on a distinguished road

      0  

    Default


    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
    Prabhat Kumar

  7. #7
    Sencha User
    Join Date
    Nov 2010
    Posts
    8
    Vote Rating
    0
    kinestetic is on a distinguished road

      0  

    Default


    Works for me:
    Project.js line 165
    Code:
    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 ';
        },
    ..........
    })

  8. #8
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    ilacyero is on a distinguished road

      0  

    Default


    De gran ayuda el codigo qu has mostrado.
    Muchas gracias.