不知道有什么办法将 utf-8 的字串转成 unicode( ucs-2 )?
我用了
new String(str.getBytes("UTF-8"),"ISO-10646-UCS-2");
但是得到一堆问号
另外, ucs-2 与 UTF-16 是什么关系, 有人说他们是一样的,不知道真假的.

解决方案 »

  1.   

    不知java的native2ascii命令可否满足需要。
      

  2.   

    可能没没进行异常处理,空值判断吧
    public static String toISO(String strvalue) {
        try{
           if (strvalue == null)
       return null;
          else 
            strvalue = new String(strvalue.getBytes("utf-8"), "ISO-10646-UCS-2"); 
           return strvalue;
       }catch(Exception e){
           return null;
       }
    }