The moose likes Java in General and the fly likes Changing charset from UTF-16 to ISO 8859-1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Changing charset from UTF-16 to ISO 8859-1" Watch "Changing charset from UTF-16 to ISO 8859-1" New topic

Changing charset from UTF-16 to ISO 8859-1

John Sisco

Joined: Nov 22, 2004
Posts: 8

I'm having problems with PostgreSQL that has some major difficulties converting scandinavian UTF-16 characters (ä - a with dots, ö - o with dots) to ISO 8859-1.


java.sql.SQLException: ERROR: could not convert UTF-8 character 0x00ef to ISO8859-1


^- I think the error above is wrong because java uses UTF-16, right ?

Well anyway, I was thinking that I could go around this problem by making the conversion on the java-side, but have some difficulties understanding the java.nio-package.

So the task is to have the sql-string to include the foobar variable as ISO-8859-1, and the code belove manages not to give the SQLException above, but am I just making a UTF-16 -> ISO 8859-1 -> UTF-16 encoding/decoding there ?

wood burning stoves
subject: Changing charset from UTF-16 to ISO 8859-1
Similar Threads
Problem preserving accented characters when writing text to file
Soap turning non-ascii chars to garbage
Converting from ISO-8859-1 to UTF-8
Read Arabic text in Servlet
character convertion in java