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

Cache title does not support UTF8 emoji #2399

Open
andrixnet opened this issue Sep 30, 2023 · 2 comments
Open

Cache title does not support UTF8 emoji #2399

andrixnet opened this issue Sep 30, 2023 · 2 comments

Comments

@andrixnet
Copy link
Contributor

I was trying to edit a cache with an emoji in the titles, taken from https://emojipedia.org
I can paste the emoji in the title field, but upon saving, it dissapears.

@stefopl
Copy link
Contributor

stefopl commented Sep 30, 2023

In my local environment, attempting the following SQL query:
UPDATE ocpl.caches t SET t.name = 'emoji Test 🔥' WHERE t.cache_id = 86263;
resulted in the error:
[2023-10-01 00:55:06] [HY000][1366] Incorrect string value: '\xF0\x9F\x94\xA5' for column 'name' at row 1
To resolve this, I executed:
alter table caches modify name varchar(255) collate utf8mb4_general_ci null;
After this change, the database worked correctly. However, on the webpage, it displayed emoji Test ?.
I solved this problem by modifying:
src/Utils/Database/OcPdo.php:35
'charset' => 'utf8' to: 'charset' => 'utf8mb4'

This is just a suggestion. It needs to be thoroughly tested

@deg-pl
Copy link
Member

deg-pl commented Oct 5, 2024

Related with #1681

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants