From the servlet, I write out.print("<a href=\"#\">я</a>");

When ajax results:

  return $.ajax({ url : options.script, type : 'POST', dataType : 'HTML', data : data }).done(function(result) { console.log("result: "+ result); } 

I get: <a href="#" rel="src/?/">?</a>

How to get the right character я instead ? ?

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

1 answer 1

Java's native encoding is utf-16. Recode to utf-8.

 String link = "<a href=\"#\">я</a>"; out.print(link.getBytes("UTF-8"));