• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Struts 2 disable native2ascii for displaying data

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having an issue with Struts2 converting Unicode data from getter methods on my action classes to ascii (each multi-byte Unicode character turns into multiple single-byte ascii characters) when displayed on my web page. IE:

"‡" turns into "‡"

The web application I am developing edits Marc Record data (book data which can be any language) and is forced as either UTF-8 or ISO-8859-1. This works fine in struts1 however it seems that i18n support in struts2 gives me this issue. Bascially, I need is to disable this automatic native2ascii conversion on my getter methods (seems like what is happening). I tried adding a char encoding filter on my web.xml but the filter didn't seem to do anything.
 
Bartender
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ben Hannon wrote: I tried adding a char encoding filter on my web.xml but the filter didn't seem to do anything.



There's more settings that need to be configured. See here.
 
Ben Hannon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe,

Thanks for the quick response, however I think you are missing what I am saying...



tagValueUnicode contains "‡" in java (the character, not the escaped html Unicode value) however when struts2 generates the <input type="text"> above and injects the value, it is "‡" again, the characters not the html escaped values.
I had to use the html escaped equivalents to display on the forum since it seems there is a character-set issue on the forum as well for posting Unicode data...
 
Ben Hannon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tracked down the issue, wasn't a struts2 issue after all... I am using HTML Tidy filter on my pages and seems it was doing the conversion on me, once I removed the filter from my web.xml, all characters are displaying correctly now...I will need to track down configuration option to disable that "feature".
 
Alas, poor Yorick, he knew 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
    Bookmark Topic Watch Topic
  • New Topic