Reputation: 8219
I faced that issue before, using Liferay POrtal, after I import lar file, any Arabic character and any special character like "♦" ruined to be question mark "?", and when I check Database, i see its stored like that too, I mean "?" .
Its explained here : Import .lar file issue on Encoding with Glassfish as Application Server
adding -DFile.encoding=UTF8
does not helped me.
AND Using Liferay itself with Arabic has no issues (like adding web content), retrieving data from DB is working well.
These days, I'm doing upgrade from liferay 5.2.8 to 6.1.20, i faced that issue again, all Arabic characters touched with upgrade (extracted to temp directory as a temp file then re-inserted to DB) got corrupted..
So its seemed to me this is issue with file system with Glassfish.
I tried Tomcat 7.0 and this issue not happened, and my data survived, but i need to solve it in Glassfish Application Server.
FYI: same issue with Glassfish v2.1.1 , v3.1.2.2 , and ML versions.
Any idea?
Upvotes: 0
Views: 1244
Reputation: 48067
Check what kind of encoding your database uses. The typical advice is to use UTF-8 for the database storage as well. Careful: When you check for correct characters in the database, your DB-tools might use a different encoding than the database itself. Sorry for the situation you're in, encoding issues are always a mess.
If you detect that your database uses a non-UTF-8 encoding, you might be lucky with specifying that encoding in the database connection string (depends on whatever database you're using), but you'd be lucky with this. You probably have a bit to repair - scripted or manually.
Upvotes: 1
Reputation: 13857
The -Dfile.encoding
is a Oracle JVM specific setting how to read Java source files. This doesn't have any influence on the charset as specified in the Content-Type header of the HTTP response.
You can add the following to the file glassfish-web.xml (located in the WEB-INF folder):
<parameter-encoding default-charset="UTF-8"/>
If you have .jsp files try that in web.xml:
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<page-encoding>UTF-8</page-encoding>
</jsp-property-group>
</jsp-config>
Upvotes: 0