module CMess::GuessEncoding::Automatic::BOMGuessers

BOM detection.

Public Instance Methods

bom_encoding_01_UTF_8() click to toggle source

UTF-8

# File lib/cmess/guess_encoding/automatic.rb, line 303
def bom_encoding_01_UTF_8
  starts_with?(0xef, 0xbb, 0xbf)
end
bom_encoding_02_UTF_16BE() click to toggle source

UTF-16 (Big Endian)

# File lib/cmess/guess_encoding/automatic.rb, line 308
def bom_encoding_02_UTF_16BE
  starts_with?(0xfe, 0xff)
end
bom_encoding_03_UTF_16LE() click to toggle source

UTF-16 (Little Endian)

# File lib/cmess/guess_encoding/automatic.rb, line 313
def bom_encoding_03_UTF_16LE
  starts_with?(0xff, 0xfe)
end
bom_encoding_04_UTF_32BE() click to toggle source

UTF-32 (Big Endian)

# File lib/cmess/guess_encoding/automatic.rb, line 318
def bom_encoding_04_UTF_32BE
  starts_with?(0x00, 0x00, 0xfe, 0xff)
end
bom_encoding_05_UTF_32LE() click to toggle source

UTF-32 (Little Endian)

# File lib/cmess/guess_encoding/automatic.rb, line 323
def bom_encoding_05_UTF_32LE
  starts_with?(0xff, 0xfe, 0x00, 0x00)
end
bom_encoding_06_SCSU() click to toggle source

SCSU

# File lib/cmess/guess_encoding/automatic.rb, line 328
def bom_encoding_06_SCSU
  starts_with?(0x0e, 0xfe, 0xff)
end
bom_encoding_07_UTF_7() click to toggle source

UTF-7

# File lib/cmess/guess_encoding/automatic.rb, line 333
def bom_encoding_07_UTF_7
  starts_with?(0x2b, 0x2f, 0x76) && next_one_of?(0x38, 0x39, 0x2b, 0x2f)
end
bom_encoding_08_UTF_1() click to toggle source

UTF-1

# File lib/cmess/guess_encoding/automatic.rb, line 338
def bom_encoding_08_UTF_1
  starts_with?(0xf7, 0x64, 0x4c)
end
bom_encoding_09_UTF_EBCDIC() click to toggle source

UTF-EBCDIC

# File lib/cmess/guess_encoding/automatic.rb, line 343
def bom_encoding_09_UTF_EBCDIC
  starts_with?(0xdd, 0x73, 0x66, 0x73)
end
bom_encoding_10_BOCU_1() click to toggle source

BOCU-1

# File lib/cmess/guess_encoding/automatic.rb, line 348
def bom_encoding_10_BOCU_1
  starts_with?(0xfb, 0xee, 0x28)
end
bom_encoding_11_GB_18030() click to toggle source

GB-18030

# File lib/cmess/guess_encoding/automatic.rb, line 353
def bom_encoding_11_GB_18030
  starts_with?(0x84, 0x31, 0x95, 0x33)
end