source: trunk/doc/configure_unicode_support.txt @ 3675

Last change on this file since 3675 was 2940, checked in by Nicklas Nordborg, 16 years ago

References #438

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 3.1 KB
Line 
1
2How to configure MySQL and Tomcat to support unicode
3====================================================
4
5The BASE core and web client supports unicode, but to take
6advantage of that the database and the servlet container must
7also be correctly configured. This document describes how to configure
8MySQL and Tomcat to fully support unicode using the UTF-8 character
9encoding. The configuration should be done BEFORE installing and
10building the database.
11
12
13MySQL
14-----
15There are two steps that must be done BEFORE the BASE
16server is installed:
17
181. Make sure the database tables can handle UTF-8 data.
19   This easiest done when you create the database by adding
20   a default character encoding to the CREATE DATABASE statment,
21   for example:
22
23   CREATE DATABASE base2 DEFAULT CHARACTER SET utf8;
24
252. Make sure the JDBC connection uses UTF-8 as the character set
26   to communicate with the database. This is done by specifying it
27   in the db.url property in the base.config file:
28   
29   db.url = jdbc:mysql://127.0.0.1/base2?characterEncoding=UTF-8
30
31Note that in the SQL statement you should use 'utf8' but in the
32connection string you should use 'UTF-8'. If 'UTF-8' doesn't work
33in the connection string you may try using 'utf8' there as well.
34In our original test only 'utf8' worked but we have got reports
35stating that now only 'UTF-8' works. If you are using another
36database than MySQL you have to look in the documentation for that
37database how to enable unicode support.
38
39Tomcat
40------
41Again, there are two steps that must be done:
42
431. Change the character encoding parameter in the web.xml file.
44   The web.xml file is located in the BASE_HOME/www/WEB-INF
45   directory. In the bottom of that file you will find a <filter>
46   tag with the name "characterEncoding". Change the value
47   of the <param-value> tag to UTF-8:
48
49   <filter>
50      <filter-name>characterEncoding</filter-name>
51      <filter-class>
52         net.sf.basedb.clients.web.servlet.CharacterEncodingFilter
53      </filter-class>
54      <init-param>
55         <param-name>characterEncoding</param-name>
56         <param-value>UTF-8</param-value>
57      </init-param>
58   </filter>
59
602. You must also edit the server.xml found in Tomcats configuration
61   directory, TOMCAT_HOME/conf. In this file you must add the
62   useBodyEncodingForURI="true" attribute to the <Connector> tag:
63
64   <Connector port="8080"
65      ...lots of other attributes...
66      useBodyEncodingForURI="true"
67   />
68
69If you are using another servlet container than Tomcat you should
70look in the documentation for that container how to make the configuration
71in step 2.
72
73
74Other character encodings
75-------------------------
76Of course, you are not limited to the UTF-8 character encoding. You can specify
77any encoding you want as long as the encoding is supported by both the database
78and the servlet container. If you want to change the encoding after the database
79has been created and populated with data you must somehow tell the database engine
80to convert the existing data to the new encoding. For instructions how to do that
81(it might be impossible) look in the documentation for your database.
82
Note: See TracBrowser for help on using the repository browser.