lib/commonmarker.rb in commonmarker-0.2.0 vs lib/commonmarker.rb in commonmarker-0.2.1

- old
+ new

@@ -16,20 +16,21 @@ # option - Either a {Symbol} or {Array of Symbol}s indicating the parse options # # Returns a {String} of converted HTML. def self.render_html(text, option = :default) fail TypeError, 'text must be a string!' unless text.is_a?(String) - Node.markdown_to_html(text, Config.process_options(option)) + Node.markdown_to_html(text.encode('UTF-8'), Config.process_options(option)).force_encoding('UTF-8') end # Public: Parses a Markdown string into a `document` node. # # string - {String} to be parsed # option - A {Symbol} or {Array of Symbol}s indicating the parse options # # Returns the `document` node. def self.render_doc(text, option = :default) fail TypeError, 'text must be a string!' unless text.is_a?(String) + text = text.encode('UTF-8') Node.parse_document(text, text.bytesize, Config.process_options(option)) end class Node # Public: An iterator that "walks the tree," descending into children recursively.