简体   繁体   中英

How to print unicode string as it is in Java?

I would like to debug emoji icon issue for Android development. My application reads text message from remote server.

String test = String.format("%s",unicodeStr);
Log.i("xxx",test);

I expect it prints something like “\⍃4", however it prints "".

So my question is, how could I print out the unicode string as it is?

Thanks a lot.

String s = "\\u23434";
System.out.println(s);

It prints unicode String as it is.

I find an another solution to solve the problem now

for (char curr : str.toCharArray()){
   //print out the character or do whatever you wanna have
   int code = curr;
   Log.i("tag",String.format("%x",code));
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM