Java - removing strange characters from a String

前端 未结 11 671
轮回少年
轮回少年 2020-12-10 03:04

How do I remove strange and unwanted Unicode characters (such as a black diamond with question mark) from a String?

Updated:

Please tell me the Unicode chara

11条回答
  •  感情败类
    2020-12-10 03:19

    same happened with me when i was converting clob to string using getAsciiStream.

    efficiently solved it using

    public String getstringfromclob(Clob cl)
    {
        StringWriter write = new StringWriter();
        try{
            Reader read  = cl.getCharacterStream();     
        int c = -1;
        while ((c = read.read()) != -1)
        {
            write.write(c);
        }
        write.flush();
        }catch(Exception ec)
        {
            ec.printStackTrace();
        }
        return write.toString();
    
    }
    

提交回复
热议问题