Reputation: 760
I just noticed very strange behavior of gsub method and maybe somebody can explain this to me. I have file which I open with standard
f=File.read(filename)
puts f.gsub('xxxxx','a')
this works fine and all xxxxx strings are replaced with a
if I open same file encoded originally in iso-8859-1
f=File.read(filename,:encoding => 'iso-8859-1')
puts f.gsub('xxxxx','a')
this doesnt work...there is no error, just ignores and xxxxx is not replaced but with 1 char only it works nice
f=File.read(filename,:encoding => 'iso-8859-1')
puts f.gsub('x','a')
is there a reason why?
edit: I am adding example file as a link to gdrive...it is default export from sql server file_in_zip
Upvotes: 0
Views: 139