473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Converting greek string to uppercase

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
5 7878
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

"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Bart Nessux | last post by:
number = random.sample(range(count), 1) This makes 'number' into a one entry list (I don't know why as 'count' is an integer). Is there an easy way to convert 'number' back to an int? TIA
1
by: The_Kingpin | last post by:
Hi all, I need to make a function that convert a string into a certain format. Here what are the restriction: -The first letter of the first and last name must be uppercase. -If a first name...
18
by: Marcio Kleemann | last post by:
I need to force the first letter of each word in a line of text to uppercase. The text comes from a TextBox control in a Web Form. I'm new to ..NET and am having a problem. Since I can't modify...
1
by: interuser | last post by:
Hi I have a web app that has a webpage on which there is a textbox and a submit button. if I type greek and press submit, the greek does not go through to the webserver. If I type greek and...
2
by: Dave | last post by:
Can someone tell me how to add Greek letters to a string? In this case I need to add the Greek letter mu to a string for display on the screen and don't know how to do it. Thanks in advance for...
10
by: pantagruel | last post by:
Hi, I'm looking for an optimal javascript function to split a camelcase string and return an array. I suppose one could loop through the string, check if character is uppercase and start...
0
by: nass | last post by:
hello everyone and happy new year. i am not sure how to tackle this problem or where is originates from so i am writing here in hope that if you can not help you can at least point me in a...
14
by: fniles | last post by:
In VB.NET 2005 can I check if a letter in a string is upper case or lower case ? For example: I have the following 2 lines: NQ,Z2003,11/11/2003,1416.5,1420,1402,1411.5...
6
by: 182719 | last post by:
<?php $testcase = 'AKLWC139'; if (ctype_upper($testcase)) { echo "The string $testcase consists of all uppercase letters. \n"; } else { echo "The string $testcase does not consist of all...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.