Sha256: 329cd4fba1256f0830deca2ddd5369b79cad94cc443a7618f197d47cf6fb91ad

Contents?: true

Size: 443 Bytes

Versions: 19

Compression:

Stored size: 443 Bytes

Contents

# -*- encoding : utf-8 -*-

class Phrase::Tool::EncodingDetector
  def self.file_seems_to_be_utf16?(file)
    file_seems_to_be_utf16_be?(file) or file_seems_to_be_utf16_le?(file)
  end

  def self.file_seems_to_be_utf16_be?(file)
    input = IO.read(file, 2)
    input and input.bytes.to_a == [0xFE, 0xFF]
  end

  def self.file_seems_to_be_utf16_le?(file)
    input = IO.read(file, 2)
    input and input.bytes.to_a == [0xFF, 0xFE]
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
phrase-0.4.33 lib/phrase/tool/encoding_detector.rb
phrase-0.4.32 lib/phrase/tool/encoding_detector.rb
phrase-0.4.31 lib/phrase/tool/encoding_detector.rb
phrase-0.4.30 lib/phrase/tool/encoding_detector.rb
phrase-0.4.29 lib/phrase/tool/encoding_detector.rb
phrase-0.4.28 lib/phrase/tool/encoding_detector.rb
phrase-0.4.27 lib/phrase/tool/encoding_detector.rb
phrase-0.4.26 lib/phrase/tool/encoding_detector.rb
phrase-0.4.25 lib/phrase/tool/encoding_detector.rb
phrase-0.4.24 lib/phrase/tool/encoding_detector.rb
phrase-0.4.23 lib/phrase/tool/encoding_detector.rb
phrase-0.4.22 lib/phrase/tool/encoding_detector.rb
phrase-0.4.21 lib/phrase/tool/encoding_detector.rb
phrase-0.4.20 lib/phrase/tool/encoding_detector.rb
phrase-0.4.19 lib/phrase/tool/encoding_detector.rb
phrase-0.4.18 lib/phrase/tool/encoding_detector.rb
phrase-0.4.17 lib/phrase/tool/encoding_detector.rb
phrase-0.4.16 lib/phrase/tool/encoding_detector.rb
phrase-0.4.15 lib/phrase/tool/encoding_detector.rb