vmg/redcarpet — pull request #358 by JuanitoFatas (2014-03-16 11:01:28+00:00)
Title: Autolink URL that contains CJK letters will raise ArgumentError.

I'm using Ruby 2.1.1p76. The follow is the test for this scenario.

Input url: http://zh.wikipedia.org/wiki/码

Render this url with `autolink` flag enabled will lead to `ArgumentError: invalid byte sequence in UTF-8`

```ruby
...

def test_auto_linked_argument_error
rd = render_with({ autolink: true }, "http://zh.wikipedia.org/wiki/码")
exp = %{

http://zh.wikipedia.org/wiki/码

\n}
html_equal exp, rd
end

...
```

When I Run: `ruby -Itest test/markdown_test.rb`

I get:

```
Error: test_auto_linked_argument_error(MarkdownTest)
ArgumentError: invalid byte sequence in UTF-8
/Users/Mac/.rvm/gems/ruby-2.1.1/gems/nokogiri-1.6.1/lib/nokogiri/html/document_fragment.rb:27:in `initialize'
/Users/Mac/.rvm/gems/ruby-2.1.1/gems/nokogiri-1.6.1/lib/nokogiri/html/document_fragment.rb:14:in `new'
/Users/Mac/.rvm/gems/ruby-2.1.1/gems/nokogiri-1.6.1/lib/nokogiri/html/document_fragment.rb:14:in `parse'
/Users/Mac/dev2/redcarpet/test/test_helper.rb:15:in `html_equal'
test/markdown_test.rb:132:in `test_auto_linked_argument_error'
129: def test_auto_linked_argument_error
130: rd = render_with({ autolink: true }, "http://zh.wikipedia.org/wiki/码")
131: exp = %{

http://zh.wikipedia.org/wiki/码

\n}
=> 132: html_equal exp, rd
133: end
134:
135: def test_memory_leak_when_parsing_char_links
```