Solved

Change the case of a string containing non-ascii characters

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Groovy problem when using SOAPUI : DispatchException occurred 7 45
eclipse buid path vs tomcat lib path 10 23
null output 3 25
jboss wildfly 10.1 10 92
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

773 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