Skip to content
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

UTF-8 special character produce an error in templates #3716

Closed
techws-dev opened this issue May 10, 2023 · 4 comments
Closed

UTF-8 special character produce an error in templates #3716

techws-dev opened this issue May 10, 2023 · 4 comments
Assignees

Comments

@techws-dev
Copy link

I upgraded to new version of Grav, and I have this error in some of my pages:

iconv(): Detected an illegal character in input string

I use utf-8 smileys in my pages, and a recent change in /system/src/Grav/Common/Helpers/Truncator.php is now throwing this error.

@rhukster
Copy link
Member

Yes, i'm aware and currently looing for a solution. I tried the recommended replacement for mb_convert_encoding() with HTML_ENTITIES, as it's deprecated in PHP 8.2 and being removed in PHP 9. Unfortunately it doesn't work with extended characters such as smiley's and some other UTF-8 chars such as ⌘.

I will get a patched released out ASAP.

@rhukster rhukster self-assigned this May 10, 2023
@rhukster
Copy link
Member

please try replacing line 147 of the Truncator.php file with:

$html = mb_encode_numericentity($html, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');

@techws-dev
Copy link
Author

It works fine !! Thanks !!

@rhukster
Copy link
Member

Great will release shortly.

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

No branches or pull requests

2 participants