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

Converting Markdown string to HTML with emojis #60

Closed
ivancantarino opened this issue Dec 20, 2017 · 3 comments
Closed

Converting Markdown string to HTML with emojis #60

ivancantarino opened this issue Dec 20, 2017 · 3 comments

Comments

@ivancantarino
Copy link

*[x] I've searched other open/closed issues for duplicates before opening up this new issue.

Report

What did you do?

I've inserted a markdown string with some emojis into it and used Down(markdownString: str).toHTML()

The markdown string was something like:

markdownString = """
		# Header 01
		## header 02
		
		**some bold text 0**
		*some italic text 0*
		
		> Blockquote text
		> multilined
		
               text with emojis: 👍😀🔞😈🤢🤖
		"""

What did you expect to happen?

Expected the toHTML() function parsed the emojis, so it would appear inside the WebView.

What happened instead?

The emojis unicode weren't parsed as expected, instead, for the emojis inserted (see above) the output inside the WebView after using the toHTML() function was the following:
(I'm reducing the unnecessary text)

text with emojis: �😀🔞😈🤢🤖
@128keaton
Copy link
Collaborator

128keaton commented Jan 20, 2018

Okay--I did a bit of investigating on this issue. It looked like the content type wasn't being set properly, but I had to make sure cmark wasn't screwing up the output. First, I built cmark from the latest source and ran your test file through it. It outputted properly in my terminal:
screen shot 2018-01-20 at 12 00 20 am
However, outputting to raw HTML rendered it exactly like your example:
screen shot 2018-01-20 at 12 00 42 am

Bad content type.

I simply appended this to the HTML file:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Before rendering in the WebView, I would make sure the content type is set. I don't think we need a change on our end, as we're just spitting out HTML exactly how cmark does it.

@ivancantarino
Copy link
Author

So all I should do isto append that tag to the head of the HTML and it should solve the issue?
Thank you for the help. 😉

@128keaton
Copy link
Collaborator

@ivan-cantarino correct!

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

3 participants