Last active
October 13, 2021 17:09
-
-
Save fjeldstad/ba90ccee0cde981655708ce1054f2a7a to your computer and use it in GitHub Desktop.
Removing all (or perhaps just "common") non-printable Unicode characters - except line breaks - from a string in JavaScript. (Adaptation of http://stackoverflow.com/questions/21284228/removing-control-characters-in-utf-8-string?lq=1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const trimmed = problematicString.replace(/[\x00-\x09\x0B-\x0C\x0E-\x1F\x7F-\x9F]/g, ''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment