JSON encoding problem.

Hi, I'm making dojo tree widget. I'm getting first node by calling RPC action method call. This method returns one node and it has Russian title. This title renders normaly.

Others nodes are got by standard widget mechanism - calling RPCUrl. This URL points to the Action's method. I'm using JSONUtil to serialize the List of objects in this methos and return them to my Tree Widget. And every thing works fine, but titles of nodes now render as set of ?. So the name of any node a get is ????? instead of , normal russian title. How can I fix it?

Here is the code snipnet of my method code :

public void interact() throws Exception{

String data = httpServletRequest.getParameter("data"); // get data container

Map map = (HashMap) JSONUtil.deserialize(data.toString()); // deserialize it

map = (HashMap) map.get("node"); // get node object

Object obj = map.get("objectId"); // get node's ID

Integer id = Integer.valueOf(obj.toString());

String string = JSONUtil.serialize(getSubRegions(id)); // get the list of objects from DB and serialize them

httpServletResponse.setContentType("text/javascript"); //write to response

PrintWriter writer = httpServletResponse.getWriter();
writer.println(string);
writer.close();
System.out.println(httpServletRequest.getQueryString());

}

And my tree is :

- NormalyTitleInRussian

|
+ ????? ??? ???

|
+ ?? ??????

Comments

I've solved the problem,

I've solved the problem, httpServletResponse just needs encoding to be set, like this :
httpServletResponse.setCharacterEncoding("UTF-8");

Back to top