Knowledgebase article 70

UTF-8 Encoding


How to setup the system for special characters (Ñ Å,Ä,Ö)

Java

Add the following Java system property to your startup options. In Tomcat this is done by adding it to your JAVA_OPTS variable (or in the wrapper.conf file as a wrapper.java.additional.n parameter in eHD 9.1 and later).

-Dfile.encoding=UTF-8


Tomcat

By default Tomcat will encode everything in ISO-8859-1. You can tell Tomcat you want it to run in UTF-8 mode by default. Open up Tomcat's conf/server.xml file and find the Connector block for http (usually on port 8080) and add the URIEncoding="UTF-8" attribute.

EXAMPLE:  

<Connector port="8080" URIEncoding="UTF-8" connectionTimeout="20000" redirectPort="8443"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>

***Using the standalone version of eHelpDesk will take care of this for you starting with version 8.2.3***


Oracle

You could just URL encode all of your data and put it into the database in ASCII like you always used to. However, that doesn't make for very readable data. There are two options:

  1. Set the default character encoding of your Oracle database to be UTF-8. However, it is set on a per server basis, not a per schema basis so your whole server would be affected.
  2. Use NVARCHAR2 fields instead of VARCHAR2 fields and you can store real UTF-8 data.

First of all, convert all fields that you want to store UTF-8 data in from VARCHAR2s to NVARCHAR2s. Be careful as I don't think you can change back!


MySQL

  1. First of all you need your databases and tables to be in utf8 character set
  2. Your MySQL instance has to run with utf8 as default character set

To accomplish the first task you can simply ALTER your table with an SQL statement like this_
ALTER DATABASE db_name CHARACTER SET utf8 COLLATE utf8_general_ci;

For the second task start your mysql-demon from the command line with following option:
_path_to_mysql\bin\mysqld —character-set-server=utf8

 You can also modify your my.cnf file to include the following parameters:

under [client]

default-character-set=utf8

under [mysqld]

default-character-set=utf8

for more information on the options see
http://dev.mysql.com/doc/refman/5.0/en/server-options.html

 


Apache

Generally you don't need to worry about Apache. However, if you are doing some proxying with mod_proxy then you might need to have a think about this.  If you've got encoded characters in URL that you need to convert into some query string for your underlying app then you're going to have a strange little problem.

If you have a URL coming into Apache that looks like this:

http://mydomain/%E4%B8%AD.doc

and you have a mod_rewrite/proxy rule like this:

RewriteRule ^/(.*) http://mydomain:8080/filedownload/?filename=$1 [QSA,L,P]

Unfortunately the $1 is going to get mangled during the rewrite. QSA (QueryStringAppend) actually deals with these characters just fine and will send this through untouched, but when you grab a bit of the URL such as the $1 here then the characters get mangled as Apache tries to do some unescaping of its own into ISO-8859-1, but it's UTF-8 not ISO-8859-1 so it doesn't work properly. So, to keep our special characters in UTF-8, we'll escape it back again.

RewriteMap escape int:escape
RewriteRule ^/(.*) http://mydomain:8080/filedownload/?filename=${escape:$1} [QSA,L,P]

Take a look at your rewrite logs to see if this is working.

 

 

Group eHD Standard Support Last modified Nov 13, 2019 Type Public Viewed 5531