Blog Archives

Wrong charset with GWT Dev-Mode in Eclipse

If you use .properties files to define the application strings, you will run into a strange behaviour of the GWT Dev-Mode in Eclipse.

All .properties files have a default charset of ISO-8859-1. You can see that on your global preferences:

eclipse-prefs

If you write your text, it will be encoded into ISO-8859-1. Now the internal Jetty sends HTTP responses with a charset ISO-8859-1, your text will be unchanged. But if the browser displays the website in UTF-8, all of your texts have the wrong charset (i.e. German umlaute will be wrong). There is no config option to change the behaviour of the Jetty, but you can set the default charset of the .properties files to UTF-8. Then the HTTP responses will change your text encoding, but the browser will change it back to the right charset (set Content-type UTF-8 within your index.html!).

JPA and then?

Some tests with JPA (EclipseLink as implementation) were not successful. I need a persistence.xml file to define different persistence contexts, but what is if I need a new context at runtime? I have to provide such an xml file, but how I can merge the new one with the already existing file without restarting the core system? It’s not nice to define all classes within the xml too, so I have closed this chapter.

I have found another interesting approach: Apache Cayenne. It seems to meet the requirements, especially the use of events during insert/update/commits etc. would allow me to integrate the ACS component of PhOSCo. So I’m thinking about a migration to this framework. Maybe I only can get some ideas from there or the complete framework. I will see.