Import .lar file issue on Encoding with Glassfish

2019-09-17 00:02发布

问题:

Simply I have an Issue with Liferay 5.2 SP4 with importing .lar file, only when liferay deployed on Glassfish, when the content have special character (Including non-latin characters like Arabic) with UTF-8 these character will corrupted after importing (all these characters going to be strange symbols or question marks), I tested Importing .lar file with liferay deployed on tomcat but I have no problem, this issue happening only on Glassfish as a Web Application Server (GF 2.1.1 or GF 3.1.1).

I think the key of problem is: "Glassfish uses ISO-8859-1 encoding by default"

So I :

added -DFile.encoding=UTF-8 to Glassfish JVM Options

Followed : Unable to change charset from ISO-8859-1 to UTF-8 in glassfish 3.1 and I added :

<jsp-property-group>
            <url-pattern>*.jsp</url-pattern>
            <page-encoding>UTF-8</page-encoding>
        </jsp-property-group>

In liferay WEB-INF/web.xml before:

</jsp-config>

and in /config/default-web.xml changed

<?xml version="1.0" encoding="ISO-8859-1"?>

to

<?xml version="1.0" encoding="UTF-8"?>

And put "commons-codec-repackaged.jar" into <GLASSFISH_HOME>/modules like what said in Liferay Administration Book.

But with no luck ! Any solution left, I need it ASAP really :(

Edit: I fixed -DFile.encoding=UTF-8 to -DFile.encoding=UTF8 with no luck too.