Class: File

Inherits:
Object
  • Object
show all
Defined in:
lib/textutils/utils.rb

Class Method Summary collapse

Class Method Details

.read_utf8(path) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/textutils/utils.rb', line 15

def self.read_utf8( path )
  text = open( path, 'r:bom|utf-8' ) do |file|
    file.read
  end

  # NB: for convenience: convert fancy unicode dashes/hyphens to plain ascii hyphen-minus
  text = TextUtils.convert_unicode_dashes_to_plain_ascii( text, path: path )

  text
end