• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Simplified Chinese in jsp

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All
I am struggling with simplified chinese characters into my jsp pages. If the jsp pages contain only html and unicode chinese characters then the pages work fine. However if I put then put in jsp tags of any sort they simply get printed out in the browser verbatim (ie not interpreted). Worse still if I then include the chinese web page in another jsp page ie:
<%@ include file="/jsp/chinese.jsp" %>
All the chinese characters suddenly become ascii junk.
I have tried using a plain jsp page with:
<%@ page language="java" contectType="text/html; charset=UTF-8" %>
and then:
<%@ include file="/jsp/chinese.jsp" %>
If anyone has any ideas at all I am prepared to try anything?
Yours struggling desperately
Andrew Och
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Regarding ur problem,
1) Don't add the page directive in the chineese.jsp
2) Add the following 2 lines in the container jsp which includes that chineese.jsp
<%@ page contentType="text/html; charset=UTF-8" %>
<% request.setCharacterEncoding("UTF-8");%>
Hope this will solve ur problem.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rajaguru,
JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "ur" instead of spelling out "your" may be convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not abbreviating these words.
thanks,
bear
JSP Forum Bartender
 
Rajaguru Ramalingam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear, I will be careful hereafter...
 
Andrew Och
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Rajaguru
I added:
<%@ page contentType="text/html; charset=UTF-8" %>
<% request.setCharacterEncoding("UTF-8");%>
But still no joy.
Just to give some more background on my problem. I wrote the jsp page in notepad adding the chinese characters using Microsoft IME. When I then save it and move the jsp page to the Linux server running Tomcat and I view just this jsp page all characters work fine and html tags also (but not jsp tags).
Opening this jsp file in anything but notepad (eg vi, emacs, netbeans) shows mismash of junk hex looking characters. Also including it in a container jsp page the page prints out html verbatim and hex instead of chinese.
So another approach is if I write a JSP page in netbeans and then cut and paste the chinese characters they fist come out as two square and when saved and reopened change to ??.
I just want to put Chinese characters into jsp pages, how does everyone else do it?
Thank you very much for your help
Andrew Och
 
Andrew Och
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Rajaguru
Oh dear I am so stupid. I saved the notepad version of the text as unicode instead of UTF-8. I have now resaved it as UTF-8 and added the lines you suggested into the container jsp:
<%@ page contentType="text/html; charset=UTF-8" %>
<% request.setCharacterEncoding("UTF-8");%>
and now it all works HOORAY!!!
Once again thank you very much for your help.
Andrew
 
reply
    Bookmark Topic Watch Topic
  • New Topic