Skip to content

Instantly share code, notes, and snippets.

@keithrbennett
Last active February 8, 2021 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keithrbennett/df0d94f44bad804cc35bb112fa0c5e84 to your computer and use it in GitHub Desktop.
Save keithrbennett/df0d94f44bad804cc35bb112fa0c5e84 to your computer and use it in GitHub Desktop.
Removes Unicode "\u200B" zero width spaces; useful for copying source code from O'Reilly learning books
#!/usr/bin/env ruby
# strip-zero-width-spaces.rb
#
# Removes Unicode "\u200B" zero width spaces; useful for copying source code from O'Reilly learning books
#
# Usage:
#
# strip-zero-width-spaces.rb < original_file > new_stripped_file
STDIN.read.each_char do |c|
print c unless c == "\u200B"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment