A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
Java in General
An Unicode (UTF8 : right arrow ->) validation
Joined: Aug 21, 2008
Apr 21, 2009 13:34:51
An Unicode (UTF8 : right arrow ->) coming from database need to validate at my
program and replacing it with "blank". Could some give some idea on this. Thanks in advance.
Joined: Oct 13, 2005
Apr 21, 2009 14:45:16
I think you need to provide more
Joined: Aug 23, 2005
Apr 21, 2009 15:07:15
You can convert the UTF-8 bytes to Unicode as shown below by the pseudo code. The compare it as a
in Java and replace with empty string.
byte utf8 = <whatever data is>
// Convert from UTF-8 to Unicode
string = new String(utf8, "UTF-8");
Hope this helps.
It is sorta covered in the
JavaRanch Style Guide
subject: An Unicode (UTF8 : right arrow ->) validation
UTF vs Unicode (JQ+)
How to store foreign characters from request parameters to beans
unicode value for char
java String UTF8
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015