title: How to remove non-printable characters
body: <p>I'm trying to remove non-printable characters from a string in Golang.</p>
  
  <p><a href="https://play.golang.org/p/Touihf5-hGH" rel="noreferrer">https://play.golang.org/p/Touihf5-hGH</a></p>
  
  <pre><code>invisibleChars := "Douglas​"
  fmt.Println(invisibleChars)
  fmt.Println(len(invisibleChars))
  
  normal := "Douglas"
  fmt.Println(normal)
  fmt.Println(len(normal))
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Douglas​
  10
  Douglas
  7
  </code></pre>
  
  <p>The first string has an invisible char at the end.</p>
  
  <p>I've tried to replace non-ASCII characters, but it removes accents too.</p>
  
  <p>How can I remove non-printable characters only?</p>