lib/zipping.rb
# Create ASCII-8bits string. Also convert encoding if needed.
Create ASCII-8bits string. Also convert encoding if needed.
Create ASCII - 8bits string . Also convert encoding if needed .
def string_to_bytes(str)
      unless @e.nil? || @e == :utf8
        if @e == :shift_jis
          begin
            str = str.gsub /[\\:*?"<>|\uff5e]/, '？'
            str.encode! 'Shift_JIS', :invalid => :replace, :undef => :replace, :replace => '？'
          rescue => e
          end
        end
      end
      [str].pack('a*')
    end
def string_to_bytes ( str ) unless @e . nil? || @e == :utf8 if @e == :shift_jis begin str = str . gsub / [ \\ :*?"<>| \uff5e ] / , '？' str . encode! 'Shift_JIS' , :invalid => :replace , :undef => :replace , :replace => '？' rescue => e end end end [ str ] . pack ( 'a*' ) end
Create ASCII-8bits string.
Create ASCII - 8bits string .
str
<not_specific>