HMBR


Tips & tricks
August 25, 2006, 4:40 pm
Filed under: java

Java:

Because I live in Brazil, a lot of words has accents , like café, computação or mão. But, some times, characters that differs from the ordinary ASCII make some app and libs crash or not working as usual, and some browsers, some times, can’t show the characters correctly.

And the big guilt are the differences between UTF and ISO8859-1, it’s hard to work using accents when people can choose one charset that is completely strange to the other, if in a language like portuguese, that is a big problem, imagine in a language like Mandarin.

So, one good trip is to avoid accents and anothers strangers characters to ordinary English(ASCII). So:

String name = sun.text.Normalizer.decompose("Hélder Máximo Botter Ribas", false, 0).replaceAll("\\p{InCombiningDiacriticalMarks}+", "")

Advertisements

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



%d bloggers like this: