Sha256: 8e10a6fa93697978a7ebd3b34a4165804a95603573cdf8a1927dbf2d98df5bd6

Contents?: true

Size: 446 Bytes

Versions: 21

Compression:

Stored size: 446 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

21 entries across 21 versions & 1 rubygems

Version Path
phrase-0.4.14 lib/phrase/tool/encoding_detector.rb
phrase-0.4.13 lib/phrase/tool/encoding_detector.rb
phrase-0.4.12 lib/phrase/tool/encoding_detector.rb
phrase-0.4.11 lib/phrase/tool/encoding_detector.rb
phrase-0.4.10 lib/phrase/tool/encoding_detector.rb
phrase-0.4.9 lib/phrase/tool/encoding_detector.rb
phrase-0.4.8 lib/phrase/tool/encoding_detector.rb
phrase-0.4.7 lib/phrase/tool/encoding_detector.rb
phrase-0.4.6 lib/phrase/tool/encoding_detector.rb
phrase-0.4.5 lib/phrase/tool/encoding_detector.rb
phrase-0.4.4 lib/phrase/tool/encoding_detector.rb
phrase-0.4.3 lib/phrase/tool/encoding_detector.rb
phrase-0.4.2 lib/phrase/tool/encoding_detector.rb
phrase-0.4.1 lib/phrase/tool/encoding_detector.rb
phrase-0.4.0 lib/phrase/tool/encoding_detector.rb
phrase-0.3.7 lib/phrase/tool/encoding_detector.rb
phrase-0.3.6 lib/phrase/tool/encoding_detector.rb
phrase-0.3.5 lib/phrase/tool/encoding_detector.rb
phrase-0.3.4 lib/phrase/tool/encoding_detector.rb
phrase-0.3.3 lib/phrase/tool/encoding_detector.rb