Announcement Announcement Module
No announcement yet.
Using MessageContext and h:messages with UTF-8 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using MessageContext and h:messages with UTF-8

    Sorry, but I have to keep bugging you all with newbie questions until I've got a little more to actually work. ;-) For the record, I'm using Spring 2.5.5 with MyFaces 1.2.3 and Facelets.

    So, I use the ReloadableResourceBundleMessageSource which supports other encodings than ISO-8859-1. That actually works fine. Now I put a message from such a property file into the MessageContext in one of my flow action classes and display it in the Facelets file, using the h:messages tag. That doesn't work so well, because the special characters seem to get treated as ISO-8859-1, so I see two meaningless characters for each special (=non-ISO-8859-1) character. The page is correctly encoded as UTF-8 (meta tag is set, encoding is set to UTF-8 in browser, other text works just fine).

    What can I do here? Is there any way to tell h:messages which encoding to use? Is there a Spring tag for Facelets which does the same, only correctly? Can I wrap h:messages into something that takes care of this? I wouldn't want to miss out on ReloadableResourceBundleMessageSource's advantage of being able to use any encoding, I don't really want to encode my messages in the property file. I mean, UTF-8 has been around long enough really. ;-)

  • #2
    Ok, just for the record and anyone with similar problems: The cause of this problem didn't have anything to do with the h:messages tag. It was rather caused by Spring automatically loading my files, but with the wrong encoding. All details:
    Once I sorted that out, the encoding of the messages was ok.