Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

toLowerCase and encoding

Thread view: 
eduardo.rosa@gmail.com - 08 Aug 2006 15:32 GMT
Hi people
I need some help to a problem that's make me loose my mind.

When I try to convert toLowerCase a string, all latin characters turns
to trash...

I tried to convert using String(byte[] bytes, String enc) and
getBytes(String enc) and nothing...

thanks a for any help.

the test class, utf-8 file:
public class StringUtil
{
    public static String convertLatin( String s )
    {
        return s.toLowerCase();
    }
}

the test calling class, also utf-8 file:
public class TestConvert
{
    public String novoItem( final String novo ) /* thats novo String is
utf-8 */
    {
        return StringUtil.convertLatin( novo );
    }
}
Chris Uppal - 08 Aug 2006 16:07 GMT
> public String novoItem( final String novo ) /* thats novo String is
> utf-8 */

What do you mean here ?  My apologies if I'm misunderstanding you, but it looks
as if you are trying to use an instance of String to hold data in UTF-8
format -- and that's a very bad idea unless you know /exactly/ what you are
doing (and is a pretty stupid idea even then).  Strings (instances of
java.lang.String) are for holding character data -- text.  If you want to hold
binary data, such as UTF-8, then you will find it much easier to hold it in
byte[] arrays.

   -- chris
analu.rosa@gmail.com - 08 Aug 2006 18:11 GMT
hehe...

The problem is: the servlet receive a string and writes other, the ajax
thing reads and do something. The strange thing is the characters was
lost in toLowerCase() function, all other proccess works well ( I make
a lot of tests.... ).

thanks a lot


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.