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.