-
-
Notifications
You must be signed in to change notification settings - Fork 615
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
Broken meta.date_formatted output #560
Comments
We really should implement i18n and not rely on Anyway, since The funny thing is that PHP includes special charset detection lists (available via Can you please check whether the following works for you? (it should, just wanna be sure) if ($meta['time']) {
$encodingList = (mb_detect_order() === [ 'ASCII', 'UTF-8' ]) ? [ 'ASCII', 'UTF-8', 'CP1252' ] : mb_detect_order();
$meta['date_formatted'] = mb_convert_encoding(strftime($dateFormat, $meta['time']), 'UTF-8', $encodingList);
} else {
$meta['date_formatted'] = '';
} Still a hack... As I said, relying on |
I see. I replaced the original if (empty($meta['date_formatted']) && $meta['time']) {
$encodingList = (mb_detect_order() === [ 'ASCII', 'UTF-8' ]) ? [ 'ASCII', 'UTF-8', 'CP1252' ] : mb_detect_order();
$dateFormat = $this->getConfig('date_format');
$meta['date_formatted'] = mb_convert_encoding(strftime($dateFormat, $meta['time']), 'UTF-8', $encodingList);
} and it works! Thanks! |
Here, do you mean that the encoding of Or do you mean that both the encodings of Just curious. Thanks! |
And is this hack going to be part of Pico or should I keep patching it myself? |
Exactly. If you save
Will be released with v2.1.4 👍 |
``` * [Changed] Silence PHP errors in Parsedown * [Fixed] #560: Improve charset guessing for formatted date strings using `strftime()` (Pico always uses UTF-8, but `strftime()` might not) ```
Hello,
I set my
date_format
inconfig/config.yml
to%Y년 %m월 %d일
in ko_KR.UTF-8 (Korean). When I print{{ meta.date_formatted }}
, its output is broken (2019ë 12ì 07ì¼
instead of2019년 12월 07일
) because of line 1,522 invendor/picocms/pico/lib/Pico.php
:I was able to fix this issue by removing
utf8_encode()
:This issue is due to double UTF-8 encodings. It can be easily replicated:
outputs
Please remove
utf8_encode()
from the above line.Thanks!
The text was updated successfully, but these errors were encountered: