| Module | Spreadsheet::Encodings |
| In: |
lib/spreadsheet/encodings.rb
|
Methods for Encoding-conversions. You should not need to use any of these.
# File lib/spreadsheet/encodings.rb, line 6 6: def client string, internal='UTF-16LE' 7: string.force_encoding internal 8: string.encode Spreadsheet.client_encoding 9: end
# File lib/spreadsheet/encodings.rb, line 39
39: def client string, internal='UTF-16LE'
40: string.delete "\0"
41: end
# File lib/spreadsheet/encodings.rb, line 21
21: def client string, internal='UTF-16LE'
22: key = [Spreadsheet.client_encoding, internal]
23: iconv = @@iconvs[key] ||= Iconv.new(Spreadsheet.client_encoding, internal)
24: iconv.iconv string
25: end
# File lib/spreadsheet/encodings.rb, line 26
26: def internal string, client=Spreadsheet.client_encoding
27: key = ['UTF-16LE', client]
28: iconv = @@iconvs[key] ||= Iconv.new('UTF-16LE', client)
29: iconv.iconv string
30: end
# File lib/spreadsheet/encodings.rb, line 42
42: def internal string, internal='UTF-16LE'
43: string.split('').zip(Array.new(string.size, 0.chr)).join
44: end
# File lib/spreadsheet/encodings.rb, line 10
10: def internal string, client=Spreadsheet.client_encoding
11: string.force_encoding client
12: string.encode('UTF-16LE').force_encoding('ASCII-8BIT')
13: end
# File lib/spreadsheet/encodings.rb, line 31
31: def utf8 string, client=Spreadsheet.client_encoding
32: key = ['UTF-8', client]
33: iconv = @@iconvs[key] ||= Iconv.new('UTF-8', client)
34: iconv.iconv string
35: end