lib/whimsy/asf/agenda.rb in whimsy-asf-0.0.5 vs lib/whimsy/asf/agenda.rb in whimsy-asf-0.0.6
- old
+ new
@@ -50,9 +50,15 @@
end
end
def parse(file)
@file = file
+
+ if not @file.valid_encoding?
+ filter = Proc.new {|c| c.unpack('U').first rescue 0xFFFD}
+ @file = @file.chars.map(&filter).pack('U*').force_encoding('utf-8')
+ end
+
@@parsers.each { |parser| instance_exec(&parser) }
# add index markers for major sections
CONTENTS.each do |section, index|
@sections[section][:index] = index if @sections[section]