Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:autolink option adds non UTF-8 chars when email is next to Japanese text #729

Open
johnnyshields opened this issue Apr 29, 2022 · 0 comments

Comments

@johnnyshields
Copy link

johnnyshields commented Apr 29, 2022

Tested on Ruby 3.0 with latest redcarpet master ref 50961ad (issue also present on latest release v3.5.1)

This code demonstrates the issue:

Redcarpet::Markdown.new(Redcarpet::Render::HTML, { autolink: true }).render('連絡先:test@test.com')
#=> "<p>連絡先\xEF\xBC<a href=\"mailto:%9Atest@test.com\">\x9Atest@test.com</a></p>\n"

Notice presence of non-UTF-8 chars \xEF\xBC and \x9A. When using in a Rails view, etc. you'll get:

ArgumentError - invalid byte sequence in UTF-8

As a workaround, adding a normal whitespace char just before the email address prevents the issue.

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

No branches or pull requests

1 participant