Sha256: 07b00342bfe2c95a9e266cc747a8e808896a651d6abb97cb2165f46fe4a89b83
Contents?: true
Size: 410 Bytes
Versions: 45
Compression:
Stored size: 410 Bytes
Contents
module Utils # JRuby chokes when strings like "\xfe\x00\xff", which are not valid UTF-8, # appear in the source. Use this method to build such strings. # char_array is an array of byte values to use for the string. module_function def make_byte_string(char_array, encoding = 'BINARY') char_array.map do |char| char.chr.force_encoding('BINARY') end.join.force_encoding(encoding) end end
Version data entries
45 entries across 45 versions & 2 rubygems