Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#980 closed defect (fixed)

ExtJs apps lang files are compressed with wrong encoding

Reported by: landry Owned by: geonetwork-devel@…
Priority: major Milestone: v2.8.0 RC2
Component: User interface (web) Version: v2.8.0RC1
Keywords: encoding Cc:

Description

In the context of building geosource from trunk, the App-mini.js generated file ends up with all utf-8 chars from web-client/src/main/resources/apps/js/OpenLayers/lib/OpenLayers/Lang/fr.js (and probably other langs) are replaced by '?' in the temporary ./target/classes/apps/js/GeoNetwork/lib/GeoNetwork/lang/fr.js file, and in the yui-compressed App-mini.js file.

So all translations strings coming from extjs look broken, they end up in the ui as ??, so for example on geosource homepage i get 'crit??res avanc??es' instead of 'critères avancés'.

The easy fix i've found is to force yuicompressor-maven-plugin to use utf-8 encoding :

Index: web-client/pom.xml =================================================================== --- web-client/pom.xml (revision 9207) +++ web-client/pom.xml (working copy) @@ -78,6 +78,7 @@

<nosuffix>true</nosuffix> <gzip>false</gzip> <force>true</force>

+ <encoding>${project.build.sourceEncoding}</encoding>

<nomunge>true</nomunge> <jswarn>${minify.verbose}</jswarn> <excludes>

By default it seems yuicompressor is supposed to be in utf-8, but in my environment it was not the case.

Note that i havent checked, but it seems only geosource/pom.xml defines project.build.sourceEncoding, so it 'might' break geonetwork. We can aswell hardcode utf-8 here, since all the lang files are in utf-8...

Attachments (1)

0001-Fix-minified-js-encoding-enforce-UTF-8-bug-980.patch (1.1 KB ) - added by landry 12 years ago.
Enforce encoding utf8 in yuicompressor

Download all attachments as: .zip

Change History (4)

by landry, 12 years ago

Enforce encoding utf8 in yuicompressor

comment:1 by landry, 12 years ago

After a bit more digging... this is equivalent to passing -Dfile.encoding=UTF-8 to maven, and fixes the issue for me. Otherwise, all accentued/utf chars are replaced by ? in the generated .js.

ie for example in gn.libs.map.js GeoNetwork.lang.fr={featureInfoTooltipTitle:"caract??ristique" vs GeoNetwork.lang.fr={featureInfoTooltipTitle:"caract<C3><A9>ristique" (utf-display in vim, this one is correctly displayed in the browser)

comment:2 by jesseeichar, 12 years ago

Resolution: fixed
Status: newclosed

comment:3 by landry, 12 years ago

Milestone: Future releasev2.8.0 RC2
Version: v2.6.5v2.8.0RC1
Note: See TracTickets for help on using tickets.