marshal error with nom ascii chars

M

Marcelo Cavaco

first. sorry about my english. i dont speak english very well.

please, someone help me...

i have an array with 2 colums.

ex: myfiles[1] = name of file
myfiles[2] = text of file

i used marshal.dump in this array.

later... i try use marshal.load

ex:

line 1 - scbase = File.open(source, 'rb') { |f| Marshal.load f }
line 2 - scbase.each do |script|
line 3 - myfiles[1].gsub! ':', ' '
line 4 - path = folder + myfiles[1] + '.txt'
line 5 - myfiles_text = Zlib::Inflate.inflate(myfiles[2])
line 6 - File.open(path, 'wb') {|file| file.write(myfiles_text) }
line 7 - end

if the second line of array contain a file name with non asciii char,
the loop dont work.

when the line 4 is executed, the next loop is executed.

ex:

if the array contains 3 files:

1 = test
2 = test * number 2
3 = another test

the line 2 is ignored and only 2 files is created.

but there is no error.

I thought to replace * with _ before the line 5.

but the loop is aborted before. in line 4.

any ideas?

please, help-me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top