You're viewing a comment by Chip Camden and its responses.

November 13, 2012, 19:21

How about if you're filtering data to pass to a legacy system that only understands ASCII?

Comment Responses

drbitboy Permalink
December 28, 2012, 02:03

archving 7-bit ASCII documents in the Planetary Data System


tr -d '\n\r -z' < blah.txt | wc -c

should return zero. I've used this 'trick' many times.

Jane Doe Permalink
April 02, 2013, 01:55

How would I use this, then? Drop all invalid characters? Replace them all with a fixed value? Check for bad strings and abort? Besides being kind of hard to read, this is pretty limiting in what your options are when you encounter such a character.

I'd use something like #map which is easier to understand, and more flexible in what it can do when it encounters a non-ASCII character.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the first letter of your name: (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.