简体   繁体   English

如何将unicode字符串转换为可读字符串

[英]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" 我有这个字串"\\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 : 所有U应该为小写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: 输出:

אוגנדה

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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