Skip to content

Fix issue of UTF-8 belows the autolinked email address. - #463

Open
davy-tw wants to merge 1 commit into
vmg:masterfrom
CatCafe:master
Open

Fix issue of UTF-8 belows the autolinked email address.#463
davy-tw wants to merge 1 commit into
vmg:masterfrom
CatCafe:master

Conversation

@davy-tw

@davy-tw davy-tw commented Feb 7, 2015

Copy link
Copy Markdown

See #388 for more details.

@jstewart

Copy link
Copy Markdown

@vmg - Any chance of seeing this merged? #388 is biting me pretty hard, and and this PR fixes that bug.

Reproduce:

renderer = Redcarpet::Render::HTML.new(with_toc_data: true)
md = Redcarpet::Markdown.new(renderer, no_intra_emphasis: true, tables: true, autolink: true, quote: true)
md.render("“foo@example.com“")

# => "<p>“<a href=\"mailto:foo@example.com%E2\">foo@example.com\xE2</a>\x80\x9C</p>\n"
# irb(main):008:0> md.render("“foo@example.com“").valid_encoding?
# => false

As you can see, the first quote is rendered properly but the second is not.

@davy-tw

davy-tw commented Jan 1, 2021

Copy link
Copy Markdown
Author

maybe ping @robin850 ...?

kaorukobo added a commit to kaorukobo/redcarpet that referenced this pull request Feb 18, 2022
kaorukobo added a commit to kaorukobo/redcarpet that referenced this pull request Feb 18, 2022
Comment thread test/markdown_test.rb Outdated
end

def test_auto_linked_email_utf8_issue
rd = render_with({ autolink: true }, "a@b.c」\nd@example.coü")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part fails on the latest source at 03b664d. So it should be:

rd = render("a@b.c」\nd@example.coü", with: [:autolink])
exp = %{<p><a href="mailto:a@b.c">a@b.c</a>」\n<a href="mailto:d@example.co">d@example.co</a>ü</p>}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG this project is still alive!!

Got it, I will rebase this PR soon. Thanks for reviewing. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants