サーバーにAJAXリクエストを送信しています.param値は「escape(...)」関数でエンコードされています。
Tomcat サーバー (7.0.42) は、受信側のコネクタに URIEncoding="UTF-8" が設定されています。web.xml で SetCharacterEncodingFilter を次のように設定しました。
<filter>
<filter-name>charencode</filter-name>
<filter-class>
org.apache.catalina.filters.SetCharacterEncodingFilter
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charencode</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
、さらに、応答を UTF-8 としてエンコードするフィルターを作成しました。
@Override
public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException {
arg1.setCharacterEncoding("UTF-8");
arg2.doFilter(arg0, arg1);
}
ラテン文字セットに由来するパラメーターの解析に問題はありませんが、ロシア語を試してみると、request.getParameter(..) は null を返します。さらに、ログでこれを取得します(SetCharacterEncodingFilterから来ていると思われます):
INFO: Character decoding failed. Parameter [usersaid] with value [%u044B%u0432%u0430%u044B%u0432%u0430%u044B%u0432%u044B%u0432%u0430%u044B%u0432%u0430%21] has been ignored. Note that the name and value quoted here may be corrupted due to the failed decoding. Use debug level logging to see the original, non-corrupted values.
そして、従うべきDEBUGレベルのメッセージはありません(私のロガーは正しく設定されていると思います..)
アドバイスいただけますか?質問に喜んでお答えします!
どうもありがとう、ビクター。