Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Display issue in inputTextArea  RSS feed

 
Veerabhadra Rao
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

in xhtml i have added a inputText/inputText area and i have written a customvalidator to accept only alphanumerics with some special characters like , . - _ & #.

when i gave “ ” in input fields, i am getting proper error message but junk characters are displaying in input fields. “”

how to avoid this display error. i tried with UTF-8 encoding and filters also but getting the same issue.

Please someone help.
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something sounds odd about that. When inputText is rejected by a validator, the original text is supposed to remain completely unchanged.

There are several things that need to be in sync in order to display and input text properly in a web browser. The most important one is the codepage setting of the client (browser) itself, since that's the one that the local font mapper uses. For US-based Windows clients, that defaults to CP-1526. Other locales may be using other defaults, and, of course a user can manually change that. Linux for USA and most of Europe was historically ISO-8859-1, I think (Roman alphabet).

Then you have the rendering codepage, which is typically something like UTF-8, and indicates what codepage the JSF rendering engine was (hopefully) using. Recall that internally, Java employs 16-bit Unicode for character and string operations, so UTF-8 basically is a downshift to make the rendered text look like ASCII.

And then there's the input codepage, which is what the input processors (Controllers) use to determine what codepage to convert from to create the internal Unicode string values of their respective controls.

So, if I've got it all straight, you need to have all of the following set to (reasonably) compatible values: A) browser codepage, B) XML source codepage (as defined on the "<?XML" Processing Instruction, C) rendered output codepage (from the <html> directive, possibly overridden selectively for certain child elements, D) input data translation codepage (inherited from page, but subject to per-control override) and finally E) Internal processing codepage (which we'll HOPE was Unicode, because otherwise you have to do everything via brute force using stuff like byte arrays.

It's a wonder things work as well as they do, especially since most of us simply get by on the defaults.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!