Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom control + character encoding issue

 
Branislav Milojkovic
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am using JSF 1.2 with JBoss 5.1 in Eclipse EE Helios.

The weird behavior I initially got was that rendering of my JSF page would seem to stop on it's own in the middle of rendering, and pretty bizarely, along the lines of :


And that's IT - no more output afterwards.

The stopping always happened somewhere in a specific list, but not always at the same place. The list was rendered by my own custom component, and it was outputting items from a DB. In the end, it turned out that there is an item in the list (although nowhere near where the breaking would occur) that had a UTF-8 character, which apparently broke the page mid-rendering (I conclude this from the fact that if the sole item is left out, rendering is done perfectly ok).

What I need now is a way to render this item. (:

What i have done:

1. Set character encoding on the page by:


and


2. Register a filter to set the encoding:



3. Register a PhaseListener to set the encoding:



4. Intercept the ResponseWriter for my component and set it's content type (I may have done this uncleanly as I haven't found a way to do it as it should be done; truth be told, I didn't put much effort in it, either, but this seems legit to me anyway)



I haven't managed to find much info on the web about this issue. The most insightful resource I found was this one:

http://www.coderanch.com/t/211549/JSF/java/JSF-Character-Sets-UTF-mainly

But it still doesn't provide a solution to my problem.

Any info is well appreciated.

Thanks,
Branislav
 
Branislav Milojkovic
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A small addition:

step 4 is definitely implemented wrong. It causes a similar breaking on it's own. If I leave it, then I get similar behavior for any kind of output from the custom control. If I remove it, the code at least works for standard characters.

Does anyone have an idea on how to modify the renderer? This is the only line of investigation that makes sense to me atm, but if anyone has another idea, feel free to say so.

Tnx,
Branislav
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic