简体   繁体   中英

How do I convert a unicode-string to a readable string

I have this string "\\U05d0\\U05d5\\U05d2\\U05e0\\U05d3\\U05d4","\\U05d0\\U05d5\\U05d6\\U05d1\\U05e7\\U05d9\\U05e1\\U05d8\\U05df","\\U05d0\\U05d5\\U05e1\\U05d8\\U05e8\\U05d9\\U05d4"

how do i convert it to a readable string? (note this is supposed to be hebrew)

i tried this method but it didnt work

byte[] bytes = s.getBytes();
String decoded = new String(bytes); 
System.out.println(decoded);

All U should be lowercase u :

    String s = "\u05d0\u05d5\u05d2\u05e0\u05d3\u05d4";

    try{

        byte[] bytes   = s.getBytes();
        String decoded = new String(bytes); 

        System.out.println(decoded);

    } catch(UnsupportedEncodingException e) {      
        // ...  
    }

See Byte Encodings and Strings .

Output:

אוגנדה

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