Character Encoding

From DBSight Full-Text Search Engine/Platform Wiki

Change Default Character Encoding

Sometimes you may want to use character encoding other than the default UTF-8.

For example, if your original website is using gb2312, the query sent to dbsight will be encoded in gb2312. So dbsight need to parse the query in gb2312, and most likely you also want the search results to be displayed in gb2312.

If you are does not change character encoding, the query encoded in gb2312 will get no search results.

To change the encoding, you need to change WEB-INF/web.xml to set encoding for ApplicationInitServlet

   <servlet-name>ApplicationInitServlet</servlet-name>
   <servlet-class>net.opencomp.foundation.ApplicationInitServlet</servlet-class>
   <init-param>
     <param-name>encoding</param-name>
     <param-value>gb2312</param-value>
   </init-param>
   ...

Acceptable values for <param-value>can be: utf-8, gb2312, ..., etc.

Notes

  • The encoding will be concatenated with "text/html; charset=" to form content type.
  • The encoding is effective for all indexes managed by one dbsight sever.