Solved

Change the case of a string containing non-ascii characters

Posted on 2003-11-25
4
217 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Bot application - advice 3 60
Eclipse with various Java releases 7 47
glassfish admin console 1 21
Website checklist for browser compatibility? 2 37
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

756 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