title: Remove non-ASCII non-printable characters from a String
body: <p>I get user input including non-ASCII characters and non-printable characters, such as  </p>
  
  <pre><code>\xc2d
  \xa0
  \xe7
  \xc3\ufffdd
  \xc3\ufffdd
  \xc2\xa0
  \xc3\xa7
  \xa0\xa0
  </code></pre>
  
  <p>for example:</p>
  
  <pre><code>email : abc@gmail.com\xa0\xa0
  street : 123 Main St.\xc2\xa0
  </code></pre>
  
  <p>desired output:</p>
  
  <pre><code>  email : abc@gmail.com
    street : 123 Main St.
  </code></pre>
  
  <p>What is the best way to removing them using Java?<br>
  I tried the following, but doesn't seem to work</p>
  
  <pre><code>public static void main(String args[]) throws UnsupportedEncodingException {
          String s = "abc@gmail\\xe9.com";
          String email = "abc@gmail.com\\xa0\\xa0";
  
          System.out.println(s.replaceAll("\\P{Print}", ""));
          System.out.println(email.replaceAll("\\P{Print}", ""));
      }
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>abc@gmail\xe9.com
  abc@gmail.com\xa0\xa0
  </code></pre>