Solved

Change the case of a string containing non-ascii characters

Posted on 2003-11-25
4
219 Views
Last Modified: 2013-12-03
I need to change the case of a string which contains non-ascii characters like " è, à " using Java.
I tried out using toUppercase( ). But it didn't work out.
It is stripping off the non-ascii characters present in the string.
Please let me know of any method in Java which does this.

It is a bit urgent.

thanx in advance
0
Comment
Question by:asifk1981
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 200 total points
ID: 9817148
You have to use toUppercase( Locale loc )

with loc set to the Locale of the text your are uppercasing...

toUppercase() just uses the default locale for your computer (which I guess can't handle è and à)

For French, you would have to do:

str = str.toUppercase( Locale.FRENCH ) ;
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9817181
Also, what do you mean by "stripping off"?

Do you mean it removes them?

Or do you see question marks?

The question marks could be because you don't have the correct font installed... you would have to look at the char value of that character to check it is right after the toUpperCase() ;

Tim

PS:  "toUppercase(" in my above post should be "toUpperCase(" :-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question