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

Copy encoding when escaping hrefs/HTML #133

Merged
merged 3 commits into from
Feb 15, 2021
Merged

Copy encoding when escaping hrefs/HTML #133

merged 3 commits into from
Feb 15, 2021

Conversation

kivikakk
Copy link
Collaborator

Fixes #130.

Looking at this code makes me feel weird. I guess we kind of leak result in these methods. They're allocated from the arena the node belongs to, so they get reset whenever rb_markdown_to_html is called, which should be often enough, but if people don't use that method, these might be leaky.

@gjtorikian
Copy link
Owner

If you feel up to it, I'd probably argue for some kind of c_str_to_rb_enc helper method to wrap these up, but eh, this is fine. I made decent progress on the Rust port so I don't think thinking much longer on the C maintainability is worth it.

@kivikakk
Copy link
Collaborator Author

Good thinking. I've named it to fit the other encoding helper. (I wonder if I shouldn't just use that here, because it's unlikely non-UTF-8 data could even be used with this.. but leaning toward not thinking much longer on C maintenance.)

@kivikakk kivikakk merged commit e8a9029 into main Feb 15, 2021
@kivikakk kivikakk deleted the encoding-mismatch branch February 15, 2021 00:51
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.

In HtmlRenderer, escape_html() returns a string with encoding #<Encoding:ASCII-8BIT>
2 participants