On Tue, Aug 24, 2010 at 4:32 PM, Ranjith <[email protected]> wrote:
> Hi,
> This script is used to remove binary (garbage) characters from a text
> file.
>
> unless ARGV.length == 1
> puts "Dude, not the right number of arguments."
> puts "Usage: ruby PrintableCharsOnly.rb YourInputFile > YourOutputFile\n"
> exit
> end
>
> file = ARGV[0]
>
>
> File.readlines(file).each do |line|
> line.each_byte { |c|
> print c.chr if c==9 || c==10 || c==13 || (c > 31 && c < 127)
> }
> end
>
this one works for ASCII only i guess. what about file containing
multilingual characters with UTF-8 ?
- balachandar muruganantham
எனது தமிழ் பக்கங்கள் - http://www.balachandar.net/pakkangal
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc