I recently updated my gem library, now a simple program outputs \000
chars.
What has changed and is causing the \000 after each char output ?
And how to correct the problem.
Thanks for the help.
----- Snippet of input file:
aalib-ruby (0.7.1)
Author: Patrick M.
Homepage: http://aalib-ruby.rubyforge.org/
----- lister.rb program
t= IO.readlines(“gems2.txt”)
puts “hello”.inspect
puts t[0].inspect #print 1st line of file
— output from lister.rb
C:\Users\spanton\Documents\GemList>ruby lister.rb
“hello”
“a\000a\000l\000i\000b\000-\000r\000u\000b\000y\000 \000
(\0000\000.\0007\000.\00
01\000)\000\r\000\n”
On Jul 30, 2009, at 11:35 AM, John wrote:
Homepage: http://aalib-ruby.rubyforge.org/
“hello”
“a\000a\000l\000i\000b\000-\000r\000u\000b\000y\000 \000
(\0000\000.\0007\000.\00
01\000)\000\r\000\n”
Is the file system using UTF-16 perhaps?
-Rob
Rob B. http://agileconsultingllc.com
[email protected]
On Thu, Jul 30, 2009 at 11:35 AM, John[email protected] wrote:
Homepage: http://aalib-ruby.rubyforge.org/
“hello”
“a\000a\000l\000i\000b\000-\000r\000u\000b\000y\000 \000
(\0000\000.\0007\000.\00
01\000)\000\r\000\n”
Hmmmm, my first guess is that the null characters really ARE in the
file “gems2.txt”
perhaps it changed since the last time you ran the program?
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
John [email protected] wrote:
I recently updated my gem library, now a simple program outputs \000
chars.
What has changed and is causing the \000 after each char output ?
As others have said, it looks like your input is UTF-16. Either treat
it as UTF-16 or convert it to something else… You think you know
what the input file looks like when you view it in some other program,
but that other program is hiding the null bytes from you. They are
really there. m.