By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.

Converting greek string to uppercase

P: n/a
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.toU pperCase()) {
....
}

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?

Vangelis Natsios

Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Perhaps you could override toUpperCase(), to handle these special
cases if they are not to many ...

However, I am having trouble even printing greek characters correctly
on the command propmpt, so I could be talking bull here ...
Jul 17 '05 #2

P: n/a

"Alligator" <pa******@postmaster.co.uk> wrote in message
news:ee*************************@posting.google.co m...
Perhaps you could override toUpperCase(), to handle these special
cases if they are not to many ...

However, I am having trouble even printing greek characters correctly
on the command propmpt, so I could be talking bull here ...


'Talking bull' ... isn't that Spanish ? I thought it was Greek characters
the OP had trouble with ;) !!!

Cheers,

Anthony Borla
Jul 17 '05 #3

P: n/a
Alligator wrote:
Perhaps you could override toUpperCase(), to handle these special
cases if they are not to many ...

However, I am having trouble even printing greek characters correctly
on the command propmpt, so I could be talking bull here ...


That is not really surprising; most terminals do not support Unicode. I
would experiment with displaying the output in a JTextArea.

Ray

Jul 17 '05 #4

P: n/a
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.toU pperCase()) {
...
}

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

Jul 17 '05 #5

P: n/a
Raymond DeCampo <rd******@hold-the-spam.twcny.rr.com> wrote in message news:<RL********************@twister.nyroc.rr.com> ...
Alligator wrote:
Perhaps you could override toUpperCase(), to handle these special
cases if they are not to many ...

However, I am having trouble even printing greek characters correctly
on the command propmpt, so I could be talking bull here ...


That is not really surprising; most terminals do not support Unicode. I
would experiment with displaying the output in a JTextArea.

Ray


The Java Console displays greek characters correctly, if greek are set
on the underlying operating system. I know that much.
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.