My few cents...
1. In those mentioned web pages, I noticed that none of them explicitly
specified the following HTML header:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
Yes, I understand that the same info is sent in HTTP header, but well,
that's in theory, and everybody knows that what's true in theory isn't
always true in practice. At least I know that Netscape 4 had a bug like
this: it would somehow ignore the encoding in HTTP header and you have to
specify the encoding in HTML header. Yeah, Netscape 4 is old, and it's dead
:) That's just an example :p
And what if another encoding is specified in HTML header, say
ISO-8859-1? Which one would the browser use in priority? Nobody knows the
answer! That's why I specify the encoding in both places.
2. To make things easier for myself, I always save JSP files in UTF-8
encoding, and I always put this header as well:
<%@ page pageEncoding="utf-8" %>
Now everything's in UTF8 from A to Z.
3. Since Java is using Unicode internally, I would try to avoid as much as
possible converting string from/to UTF-8. But it's time when things go
wrong and you can't avoid, like URL query string, and in that time, I'll use
this instruction:
String sUTF8 = new String(sWrongEncoding.getBytes("iso-8859-1"), "UTF8");
where sWrongEncoding is a string that I know have the wrong encoding
(ISO-8859-1 instead of UTF-8).
Disclaimer: I don't claim all I said are THE solutions, but they work for me
so far.