I have a little issue with Java UTF-8 converting.I have this Objective C code :
const char *p = [[NSString stringWithFormat:@"0x%@",md5Hash] UTF8String];
where md5Hash is NSString and I need to find a way to declare the same char p in Java but didn’t find how to set char to UTF-8.
Any ideas or suggestions?
I don’t know about Objective C, but in Java chars are UTF-16 and Strings internal char buffer are that way. You can convert from and to UTF-8 if you need:
or
Hope it helps…
Note: if you need an streaming solution you can also use InputStreamReader and OutputStreamWriter for this very same transformation but that’s another story…