Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Using inline_css causes emoji's to render defective #47783

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

Closed
parijke opened this issue Oct 4, 2022 · 7 comments
Closed

Using inline_css causes emoji's to render defective #47783

parijke opened this issue Oct 4, 2022 · 7 comments

Comments

@parijke
Copy link

parijke commented Oct 4, 2022

Symfony version(s) affected

6.1.5 with twig/cssinliner-extra 3.4.0

Description

{% apply inline_css %}
    <html>
    <head>
        <style>
            p { color: red; }
        </style>
    </head>
    <body>
    <p>πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡</p>
    </body>
    </html>
{% endapply %}

renders the hands as Γ°οΏ½οΏ½οΏ½Γ°οΏ½οΏ½οΏ½Γ°οΏ½οΏ½οΏ½Γ°οΏ½οΏ½οΏ½Γ°οΏ½οΏ½οΏ½Γ°οΏ½οΏ½οΏ½Γ°οΏ½οΏ½οΏ½

How to reproduce

Here's a small repo to reproduce. go to /test/bug and see the mail. I use the mailcatcher docker instance to see the sent email

https://github.com/parijke/inlincecss-bug

Possible Solution

No response

Additional Context

No response

@stof
Copy link
Member

stof commented Oct 4, 2022

Have you tried adding the <meta charset="UTF-8"> in your <head> to check whether it fixes it ? UTF-8 is not the default charset in HTML (for historical reasons).

@parijke
Copy link
Author

parijke commented Oct 4, 2022

Indeed that works... but the strange thing is, that without the {% apply inline_css %} it also works.

@stof
Copy link
Member

stof commented Oct 4, 2022

Well, inlining the CSS parses the HTML and re-dumps it. So it might be affected by the missing charset.

@parijke
Copy link
Author

parijke commented Oct 4, 2022

Thanks for explaining.

@parijke parijke closed this as completed Oct 4, 2022
@nicolas-grekas
Copy link
Member

I guess we should default to UTF-8 when the tag is missing but the content is UTF-8. Up for a PR?

@parijke
Copy link
Author

parijke commented Oct 4, 2022

Sure, if you guide me to the process (never done it before)

@xabbuh
Copy link
Member

xabbuh commented Jan 19, 2024

FTR: updating tijsverkoyen/css-to-inline-styles to a version that contains tijsverkoyen/CssToInlineStyles#238 (i.e. 2.2.6 or higher) fixes the reported issue

nicolas-grekas added a commit that referenced this issue Jan 22, 2024
This PR was merged into the 5.4 branch.

Discussion
----------

[Translation] fix multi-byte code area to convert

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

While debugging #47783 I stumbled upon tijsverkoyen/CssToInlineStyles#237 which made me realise that we suffer from the same issue in `PseudoLocalizationTranslator`. So I decided to apply the patch from tijsverkoyen/CssToInlineStyles#238 here.

Commits
-------

2eadd39 fix multi-byte code area to convert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants