This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

JSP Chinese characters scrambled even in UTF-8

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,


JSP Chinese characters scrambled even in UTF-8 encoding set in my jsp pages.I use Struts2 framework.I set the encoding as follows.

<%@ page
import="java.util.List,com.coin.core.model.transaction.SalesImagesVO,com.coin.core.util.StringUtil" pageEncoding="UTF-8"
contentType="text/html;charset=UTF-8"%>

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>


In my Struts2 action,I added the lines for each field to which i assign Chinese characters,they are

purchasevo.setProductName(new String(purchasevo.getProductName().getBytes("ISO-8859-1"),"UTF-8");


Even I set the encoding as above,It works temporarily till i trigger the next action and the chinese characters were

scrambled and appear in the jsp as peculiar characters.

How i can i get the same chinese characters when page control navigates from one page to another page.

Thanks for your suggestion.

Ramesh Kangamuthu


 
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ramesh ,

Try using setcharacterencoding filter in front of the struts2. please refer the thread attached here it will give you the better idea.

I have implemented i18n with japanese in jsp servlet but didnt find any issues its working good so basically there something which is changing the encoding for request.

Refer this thread which will be helpful to you.
http://struts.1045723.n5.nabble.com/S2-Chinese-encoding-problem-td3465287.html

Regards
Jatan
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic