Closed gexclaude closed 9 years ago
@gexclaude, And what if content's charset is not utf-8
? Maybe we should take it somewhere (add there) from settings (config.php
)?
@NeoBlack, does ready
label mean that someone already implement it? or is it open for PRs ?
@Frodox config entry would also be good.
I don't know much about text encodings, but when is HTML not UTF8? I know the markdown content can be whatever, but in this case it's the HTML output we are talking about here.
Well the default theme sets the charset to utf-8, but as I saw Phile didn't set any HTTP header. Thus charset from the HTML can differ from the encoding used to send the response. This is because PHP will use the default charset configured in php.ini AFAIK if no HTTP Header is sent before the response is built. But with that I'm also not a 100% sure.
Other question - in what case would you want NOT to use UTF-8?
I'm not sure. I think someone that provides non-latin-based languages might have to weigh in. I don't think languages like Chinese or Arabic use UTF-8 right?
Well they can. Actually UTF-8 supports it very well. IMHO there is no encoding that is more widely supported.
See http://www.quora.com/What-is-the-best-encoding-for-Chinese-simplified-characters for instance.
But what about making this a config parameter and set the default value to UTF-8 and thus have the, IMHO, best default in place?
:+1:
I have no strong opinion about it but it's probably a good idea. Only question: should it be set in template too? People could think they could overwrite the encoding there and end up with a mixed declaration. Anyhow I would go with:
$config['charset'] = 'utf-8'
The config solution makes the most sense. I think it could also be defined as a constant, like the markdown extension (.md
) is.
This can still be referenced in TWIG as well like this {{ constant('CONSTANT_NAME') }}
oops closed by accident
Closed by PR #179
It would be good if Phile would specify the charset in the HTTP response headers:
This cheers browser up as they don't need to determine the charset based on the content or the meta-tag.