UTF-8 doesn't seem to be working
nabilfreeman opened this issue · 1 comments
Hey there, I'm using this Lambda script, honestly it's awesome and you've done a great job @jblotus .
However there's one thing I can't get working which is UTF-8 support. As you can see below emoji fails to render (not a huge issue) but also even a £ sign doesn't appear to work properly which makes me think it's using the most basic of text encoding. $ works.
Here's the code I used to generate the base64...
const buffer = new Buffer('£', 'utf8');
const base64 = buffer.toString('base64');
Any idea what's happened? Is this something I can fix with a config option?
Thanks in advance
I fixed it! Should've just Googled for a few more minutes haha.
There was no encoding in my markup. I wasn't even sending a <head>
or <body>
tag, just the <div>
tags etc.
This was the important line:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
So I wrapped my rendered HTML in a <body>
tag, added the above meta in the head and put an <html>
around everything. Now renders perfectly, minus emoji.