It's not a secret anymore!
The moose likes JSF and the fly likes Unable to insert accented letters in JSF application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Unable to insert accented letters in JSF application" Watch "Unable to insert accented letters in JSF application" New topic

Unable to insert accented letters in JSF application

D. Formenton
Ranch Hand

Joined: Mar 20, 2008
Posts: 48

I have trouble to insert accented letters in a postgres database from a web application developed with netbeans.

The accented letters become sequeces of 2 or more characters.


Netabeans ver. 7.1
in faces-config.xml

Postgres ver. 9.1
Database Properties:
Encoding WIN1252
Collation Italian_Italy.1252
Character Type Italian_Italy.1252

JSF Library Primefaces v. 3.0.RC2

How I have to configure Netbeans ond/or Postgres to work correctly with Italian alphabet?

Thank you very much.


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Your brand of IDE should never have any influence on the webapp. For one thing, production webapps are far removed from the IDEs (if any) that produced them.

Locale actually doesn't control the character set encoding, though. Just the choice of resources. For example, messages in Italian would be the preferred return for resource lookups.

What you really need to look at is the Code Page in effect for the web pages themselves. UTF-8 is the most common, and it does have support for European accented Latin characters. However, for an exact match with your PostgreSQL settings, Code Page Windows-1252 would be the preferred setting, since that way the database and view would be using the exact same encoding.

Code Page Windows-1252 is very similar to the ISO-8859-1 Latin Unicode glyphset, with the most notable exception being things like the open and close-quote characters. ISO-8859-1 is actually preferable (even Microsoft recommends it these days). Non-Windows webclients such as Macintosh, Linux, and Android devices will be the most offended, otherwise.

It's unlikely that you can do anything about it at this stage, but it's worth noting that PostgreSQL's default codepage for database creation on Windows-based servers is CP-1252, but on the Unix systems, it's UTF-8.

An IDE is no substitute for an Intelligent Developer.
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218
In NetBeans, when editing a .xhtml file, you should just be able to type the '&' character, and get a (very long) list of all the
available characters. Can you give this a try?

I agree. Here's the link:
subject: Unable to insert accented letters in JSF application
It's not a secret anymore!