vscode-mjml
vscode-mjml copied to clipboard
Special characters are not rendering when HTML is copied
Expected behavior
When you export the MJML from VSC, special characters, such as an m-dash "—", should display properly.
Actual behavior
When the HTML is copied, it is converting the m-dash to —
. Other symbols have been getting converted to gibberish as well.
Originally, VSC was in windows 1252 so I thought that the encoding was the problem but it is still persisting even after I have converted to UTF-8.
If I ~export~ copy the HTML from the exact same file via the MJML desktop app, then all the HTML is good and symbols display correctly.
Update: Exporting now works. Must have been an issue with exporting in Windows 1252. Copying the HTML is still not working.
Steps to reproduce the problem
- Write MJML in VSC as normal and use special characters, like m-dashes (not the
—
but using the actual "—" character) - Copy the code
- Paste the HTML into ESP or editor and the symbols will be encoded differently.
Code sample
<mj-text padding-top="0">
<p>This is some content about nothing—but it is about something.</p>
</mj-text>
Specifications
- VS Code version: 1.29.1
- MJML extension version: 1.6.0
- Operating system and version: macOS Mojave v10.14
Other information
Not sure if there is a setting in VSC to address this or if it is an issue with the way the HTML is being compiled but I've tried updating all the encoding settings I can find to make sure UTF-8 is used but can't figure out why the MJML desktop apps works and VSC doesn't. My only thought is there is an encoding issue when the HTML is compiled.
Hi, have you tried running the export HTML command within vsc? I use em dashes regularly, but run the export command instead of the copy command, and have never run into an issue.
I ran the export before and got the same issue, but maybe that was before switching to UTF-8. When I export now, it appears to be ok. Nonetheless, would prefer to be able to copy the HTML to paste into my ESP rather than export, then copy, then paste in.
Hi @srkennedy I have the same issue. Whether I export or copy to HTML, both give me errors.
MJML environment OS: MacOS MJML Version 4.2.0 MJML tool used : MJML extension for VS Code Mac 1.6.0
Did you find a solution? How did you converted to UTF-8? Many thanks in advance !
@Redjam Nope. I'm just writing special characters as the coded version (ie. —
) to get around it. Or I use the MJML desktop app to copy the HTML.
I also updated a few things to see if that worked.
Set UTF-8 as default in the settings.
Added this to the settings.json
"files.encoding": "utf8",
"[mjml]": {
"files.encoding": "utf8",
}
Then I went through each file to make sure they were set to UTF-8 and not Windows 1252.
Still no luck though. But that's what I've done so far to try and fix.
Hello
I would like to release a new version in the next week.
Thanks both of you for your answers. @attilabuti I'm looking forward to the next release. many thanks for your work!
Hi @attilabuti, any update about the next release?
Hey @attilabuti. Any updates on this issue? 🤞🏼
Has anyone found a resolution to this?
@aaroneight no resolution for the moment. I use the online converter to avoid mistakes caused by VS extension.
Also issue with cyrillic characters. I'm getting this: https://shrtm.nu/9C1b instead of this: https://shrtm.nu/fiD8. This happens only when using "MJML: Copy HTML" command, while "MJML: Export HTML" command is working ok.