-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Twig templates] used HTML5 meta charset tag and removed hardcoded ones #7532
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
Conversation
That's wrong as those templates are used by Symfony itself and as such they are in the UTF-8 charset. |
Yes indeed, actually what I don't understand is why there are those 2 different places for the charset? (kernel and twig config). I can see that if I change the charset in my app by overriding the Kernel::getCharset() method, the HTTP response Content-Type header changes automatically, for example "text/html; charset=ISO-8859-15", while the content charset is actually UTF-8. IMO either the same charset should be enforced on both places, or if they are different, Twig should be able to convert the templates encoding to the kernel charset, so that response content is compliant with what the HTTP header states. |
@bamarni: That's indeed a bug. Can you open a ticket for that bug and close this PR? |
the core controllers (TwigBundle and WebProfilerBundle) should probably enforce the charset instead of relying on the default charset configured by the user globally. |
ok, see #7617 |
This PR was merged into the 2.3 branch. Discussion ---------- Enforce UTF-8 charset for core controllers | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #7532 | License | MIT | Doc PR | - See #7617 and #7532 for the context of this PR. Commits ------- 3032014 Enforce UTF-8 charset for core controllers
This PR was merged into the 2.3 branch. Discussion ---------- [Bundle] Fix charset config | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #13715, #7617, #7532 | License | MIT | Doc PR | - This reverts #13715 and resurrects #7532, which was fine. Commits ------- ef41059 [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback cbd0525 used HTML5 meta charset tag and removed hardcoded ones 6ca7fc9 Revert "bug #13715 Enforce UTF-8 charset for core controllers (WouterJ)"
This PR was merged into the 2.3 branch. Discussion ---------- [Bundle] Fix charset config | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#13715, symfony#7617, symfony#7532 | License | MIT | Doc PR | - This reverts symfony#13715 and resurrects symfony#7532, which was fine. Commits ------- ef41059 [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback cbd0525 used HTML5 meta charset tag and removed hardcoded ones 6ca7fc9 Revert "bug symfony#13715 Enforce UTF-8 charset for core controllers (WouterJ)"
I'd also have a suggestion, shouldn't the framework forbid twig to have a different charset than the kernel? Currently it's only the default value : https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php#L124