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