• About
Triona Weblog

Software Development and much more

Character Encoding Oddity in JSF

20.12.2013 by Anton Autor

When trying to enter my name into a JSF web form to test some underlying JPA code, the character ö broke into unreadable gibberish in both the view and the database, but when I entered another String with more Umlauts, it was displayed and saved correctly. The encoding error on the first request of a session (and only the first request) was reproducible and a look into the log revealed that encoding error happened before the Umlaut was passed to the setter inside the underlying bean.  The page with the form (and all other pages in the project) was set correctly to UTF-8, so there was no apparent reason for the encoding error. A quick web search however led to this bug report for the Mojarra Project.

Since the bug was reported as fixed, a small test was necessary to ascertain the Mojarra library as the culprit, which was done by simply replacing Mojarra in the project with MyFaces. The character encoding error did not occur using MyFaces, so different Mojarra Versions from 2.1.4 to 2.2.4 were tested, all producing the same encoding error. So either the bug has not been fixed after all or this is a separate but most likely related issue. As mentioned here and in the bug report, there are two workarounds, both of them hardly satisfying:

  1. Change the JSF implementation from Mojarra to something else or
  2. Define the charset in your pages not as UTF-8, but as the default charset ISO-8859-1.

Both solutions can have major implications and are hardly appropriate for such a rather minor problem.

Posted in: Java, JEE Tagged: JavaEE, JSF
September 2023
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  
« Nov    

Tags

API Architecture CDI Collections Comparable Comparator Database EA Eclipse EJB Enterprise Architect Excel Hessian HTML Iteration Java Java 8 JavaEE Java EE Java Enterprise Development javascript Javascript Canvas HTML5 JEE JEE 6 JPA jQuery JSF linux Makro Map MariaDB Maven Oracle Plugins Relation relationship Richfaces Service Service Facade Set SOA Subversion Tutorial VBA XML

Recent Posts

  • Domain Driven Design und Event Storming
  • NESTJS BEYOND „HELLO WORLD“
  • Jakarta EE 9 – An upheaval with difficulties
  • Jakarta EE 9 – Ein Umbruch mit Schwierigkeiten
  • Erste Schritte mit Hibernate Spatial

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2023 Triona Weblog.

Impressum | Datenschutzerklärung