We are developing some JSF web applications with PrimeFaces.
It is possible in inputText to copy paste text with non UTF-8 character like this:
xxxxx
and save the page. But there is an error in the rendered html.
Error: Forbidden code point U+fffe.
The browser doesn't show (hide) the error, it shows the non utf-8 charcter (works like in normal case)!
But, after this page will be sent from server to browser in ajax response, the browser show error in console! And user see the error!
Console message:
XML Parsing Error: not well-formed
What is the best way to handle this error?I have a lot of bad ideas. :)
I. Validate input before save!
- Client side with javascript can be general, but not secure.
- Replace bad characters to '' can cause misunderstanding by user. There are alot of bad characters which are like right accented characters.
- I can make a validator for jsf, but I should register it to all inputText components one by one.
II. Perhaps I can search the javascript what parse ajax responses and patch it.