Skip to content

[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

Closed
wants to merge 1 commit into from
Closed

[Twig templates] used HTML5 meta charset tag and removed hardcoded ones #7532

wants to merge 1 commit into from

Conversation

bamarni
Copy link
Contributor

@bamarni bamarni commented Mar 31, 2013

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

@fabpot
Copy link
Member

fabpot commented Apr 7, 2013

That's wrong as those templates are used by Symfony itself and as such they are in the UTF-8 charset.

@bamarni
Copy link
Contributor Author

bamarni commented Apr 7, 2013

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.

@fabpot
Copy link
Member

fabpot commented Apr 9, 2013

@bamarni: That's indeed a bug. Can you open a ticket for that bug and close this PR?

@stof
Copy link
Member

stof commented Apr 9, 2013

the core controllers (TwigBundle and WebProfilerBundle) should probably enforce the charset instead of relying on the default charset configured by the user globally.

@bamarni
Copy link
Contributor Author

bamarni commented Apr 9, 2013

ok, see #7617

@bamarni bamarni closed this Apr 9, 2013
fabpot added a commit that referenced this pull request Feb 24, 2015
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
fabpot added a commit that referenced this pull request Mar 12, 2015
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)"
ostrolucky pushed a commit to ostrolucky/symfony that referenced this pull request Mar 25, 2018
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)"
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

Successfully merging this pull request may close these issues.

3 participants