Re: Converting greek string to uppercase

From: Raymond DeCampo (rdecampo_at_hold-the-spam.twcny.rr.com)
Date: 11/30/03


Date: Sun, 30 Nov 2003 15:17:40 GMT

Vangelis Natsios wrote:
> I'm trying to provide a case-insensitive search in greek texts from a
> jsp page. The check goes like this:
>
> if (el_title.toUpperCase().indexOf(selected_title.toUpperCase()) {
> ...
> }
>
> where selected_title is the value of a field from the search form and
> el_title is the value retrieved from the database. The problem is that
> some of the greek characters, namely those with tonos (accent) or
> dialytika (diairesis) and the final s, are not converted to uppercase
> correctly, so the search fails (while it works ok for strings not
> containing such letters).
>
> I also tried to invoke toUpperCase() with a Locale argument, like this:
> Locale el_locale = new Locale("el");
> ...
> if
> (el_title.toUpperCase(el_locale).indexOf(selected_title.toUpperCase(el_locale))
> {
> ...
> }
>
> but it didn't work either. Any ideas?
>

If the routines are not properly translating characters to uppercase,
that could very well be a bug in the JVM. I would follow up with Sun.

Also, I would also check out some things concerning the Locale. For
example, did you try the other constructors as well? Did you try the
Locale.getAvailableLocales() method to see if the one you want is
actually installed and supported?

Another thought, a possible workaround might be to use toLowerCase() if
that is more well behaved.

Ray