Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

using unicode in jsp  RSS feed

 
Brian Nice
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a jsp with the ContentType charset set to UTF-8. When i run the following code:
<% String s = "\u3088\u3046"; %>
<%=s%>
I get two Japanese characters which is want I want. Now i have another string that gets passed to me another way, and the string gets constructed one character at a time
<% String s2 = "\\"+"u"+"3"+"0"+"8"+"8"; %>
<%=s2%>
gives me \u3088 in the browser. I need to have that string interpreted as japanese characters too.
I've tried different variations on the
String s3 = new String(s2.getBytes("encoding),"encoding"); and cannot get any of them to change what gets output. I've also tried the CharsetDecoder class but with no luck.
Is there any way to get the String that is constructed one character at a time to be interpreted as a unicode String and be correctly displayed as a Japanese character in the browser?
Thanks
Brian
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!