marshal error with nom ascii chars

Discussion in 'Ruby' started by Marcelo Cavaco, Oct 27, 2009.

  1. 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.
    Marcelo Cavaco, Oct 27, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. richard
    Replies:
    1
    Views:
    348
    Jan Burgy
    Sep 7, 2004
  2. TOXiC
    Replies:
    5
    Views:
    1,216
    TOXiC
    Jan 31, 2007
  3. Replies:
    10
    Views:
    521
    Aaron Watters
    Jun 18, 2008
  4. Michael Davis

    Ruby 1.8 and Marshal.load/Marshal.dump

    Michael Davis, Oct 10, 2003, in forum: Ruby
    Replies:
    0
    Views:
    160
    Michael Davis
    Oct 10, 2003
  5. Marcelo Cavaco

    Marshal erro with non ascii chars

    Marcelo Cavaco, Oct 27, 2009, in forum: Ruby
    Replies:
    3
    Views:
    111
    Brian Candler
    Oct 28, 2009
Loading...

Share This Page