參考這篇
http://fr-fr.facebook.com/people/Romain-Boichat/100002215660227

因為在做 solr 的 test_utf8.sh 出現了這樣子的東西

Solr server is up.

HTTP GET is accepting UTF-8

HTTP POST is accepting UTF-8

HTTP POST does not default to UTF-8

HTTP GET is accepting UTF-8 beyond the basic multilingual plane

HTTP POST is accepting UTF-8 beyond the basic multilingual plane

HTTP POST + URL params is accepting UTF-8 beyond the basic multilingual plane

所以找到了這篇 (http://fr-fr.facebook.com/people/Romain-Boichat/100002215660227) 感覺是最有用的

我選第 4 種方法, 把內定值改為 UTF-8

在 Solr 安裝好後的環境, 依 FreeBSD 8.1, Tomcat 7.x 為主

cd ${solrdir}/WEB-INF ; mkdir -p classes/filters
cp /usr/local/apache-tomcat-7.0/webapps/examples/WEB-INF/classes/filters/SetCharacterEncodingFilter.class ${solrdir}/WEB-INF/class/filters

edit ${solrdir}/WEB-INF/web.xml
不會加的話, 可以參考 /usr/local/apache-tomcat-7.0/webapps/examples/WEB-INF/web.xml 裡的設定方法

    <filter>
        <filter-name>Set Character Encoding</filter-name>
        <filter-class>filters.SetCharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
 
    <filter-mapping>
        <filter-name>Set Character Encoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

 

Tomcat with UTF-8

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料

Verified by MonsterInsights