source: trunk/doc/configure_unicode_support.txt @ 848

Last change on this file since 848 was 848, checked in by Nicklas Nordborg, 17 years ago

Added the possibility to use unicode in the database and web client

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 2.8 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=utf8
30
31If you are using another database than MySQL you have to look in the
32documentation for that database how to enable unicode support.
33
34Tomcat
35------
36Again, there are two steps that must be done:
37
381. Change the character encoding parameter in the web.xml file.
39   The web.xml file is located in the BASE_HOME/www/WEB-INF
40   directory. In the bottom of that file you will find a <filter>
41   tag with the name "characterEncoding". Change the value
42   of the <param-value> tag to UTF-8:
43
44   <filter>
45      <filter-name>characterEncoding</filter-name>
46      <filter-class>
47         net.sf.basedb.clients.web.servlet.CharacterEncodingFilter
48      </filter-class>
49      <init-param>
50         <param-name>characterEncoding</param-name>
51         <param-value>UTF-8</param-value>
52      </init-param>
53   </filter>
54
552. You must also edit the server.xml found in Tomcats configuration
56   directory, TOMCAT_HOME/conf. In this file you must add the
57   useBodyEncodingForURI="true" attribute to the <Connector> tag:
58
59   <Connector port="8080"
60      ...lots of other attributes...
61      useBodyEncodingForURI="true"
62   />
63
64If you are using another servlet container than Tomcat you should
65look in the documentation for that container how to make the configuration
66in step 2.
67
68
69Other character encodings
70-------------------------
71Of course, you are not limited to the UTF-8 character encoding. You can specify
72any encoding you want as long as the encoding is supported by both the database
73and the servlet container. If you want to change the encoding after the database
74has been created and populated with data you must somehow tell the database engine
75to convert the existing data to the new encoding. For instructions how to do that
76(it might be impossible) look in the documentation for your database.
77
Note: See TracBrowser for help on using the repository browser.