Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Change the case of a string containing non-ascii characters

Posted on 2003-11-25
4
Medium Priority
?
221 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 800 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

715 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