1

I have configured Kannel to send messages to my servlet. The URL is like this:

http://10.10.10.10/income/Submit?from=%p&to=%P&content=%a&encoding=%C

The problem is encoding is UTF-8 for English messages and UTF-16BE for Persian messages. My servlet is like:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");

    String to = request.getParameter("to");
    String from = request.getParameter("from");
    String content = request.getParameter("content");

    /* process message here */
}

With this code I can not get Persian messages.(They are converted to ASCII). When I convert request.setCharacterEncoding("UTF-8"); to request.setCharacterEncoding("UTF-16BE");, I get null for all variables. Can anyone help me how can I convert to, from, content based on encoding field? I'm using Glassfish 3.1.2.2 as container.

4

1 回答 1

1

In Kannel you can set mo-recode to 1 in smsbox group. This will tell Kannel to automatically transcode text MO messages to UTF-8 charset before sending to your HTTP service.

Just ensure if your Kannel is built with iconv support.

于 2013-08-05T19:32:31.747 回答