如何删除字符串中的特殊字符

时间:2016-02-10 03:22:32

标签: regex character-encoding

这可能是一个可能的重复。我仍然无法找到它的解决方案。是的,我尝试使用正则表达式,但有没有其他方法可以解决它?

String s="This is a â¦sample ⦠Java class to show the issueâ¨\nHow to solve it?";

        try {
        System.out.print("ANSWER="+URLDecoder.decode(s, "UTF-8"));  ;
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

我该如何解决这个问题?有人可以提供帮助 提前致谢

控制台输出

Invalid layout of java.lang.String at value
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (javaClasses.cpp:136), pid=17620, tid=14220
#  fatal error: Invalid layout of preloaded class
#
# JRE version:  (7.0_79-b15) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.79-b02 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

1 个答案:

答案 0 :(得分:1)

试试这个

User.transaction do...