lib/methan/server.rb in methan-0.1.0 vs lib/methan/server.rb in methan-0.1.1
- old
+ new
@@ -1,5 +1,6 @@
+# coding: utf-8
require "erb"
require "rack"
require "redcarpet"
require "methan/md_renderer"
@@ -93,10 +94,10 @@
name: File.basename(file),
path: file,
}
File.open(file) do |f|
title = f.gets
- title = title.gsub(/^\#\s+/, "").gsub(/\s+\#$/, "").strip
+ title = title.force_encoding('utf-8').gsub(/^\#\s+/, "").gsub(/\s+\#$/, "").strip
dat[:title] = title
end
dat
end
@files.sort!{|a, b| a[:id] <=> b[:id] }