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

MODX, MIGX and Polylang Cyrillic? #428

Open
modx-developer opened this issue Apr 27, 2024 · 3 comments
Open

MODX, MIGX and Polylang Cyrillic? #428

modx-developer opened this issue Apr 27, 2024 · 3 comments

Comments

@modx-developer
Copy link

Good afternoon!

The problem is that sometimes migx or modx encodes the input text in the fields, but there are fields (randomly) where it does not want to encode and the database writes Cyrillic.

This is what it writes to the database:

[{“MIGX_id”:“1”,“title”:“Гидропилинг Glow Solution”,“description”:“”,“name”:“”,“price”:“”},{“MIGX_id”:“2” },{“time”: “60 min”, “title”:“”, “description”:“”, “name”: “Face + Neck Area”, “price”: “2,500”},{“MIGX_id”: “3”, “time”: “30 min”, “title”:“”, “description”:“”, “name”: “Decollete Area”, “price”: “1,500”},{“MIGX_id” : “4”, “time”: “90 min”, “title”:“”“, ‘description’:”", ‘name’: ‘Face + Neck + Decollete Area’, ‘price’: ‘3,500’} , {“MIGX_id”: “5”, “time”: “30 min”, “title”:“”, “description”:“”, “name”: “Outer palm area”, “price”: “1,000”}]

and it should be like this (as an example):

[{“MIGX_id”: “1”, “title”: “RF -\u043b\u0438\u0444\u0442\u0438\u043d\u0433 Morpheus 8”, “description”: “”,“name”:“”,“price”:“”},{“MIGX_id”:“2”,“time”:“60 \u043c\u0438\u043d”,“title”:“”,“description”:“”,“name”: “\u0417\u043e\u043d\u0430 \u043b\u0438\u0446\u0430”,“price”:“15 000”},{“MIGX_id”:“3”,“time”: “60 \u043c\u0438\u043d”,“title”:“”,“description”:“”,“name”:“\u0417\u043e\u043d\u0430 \u0448\u0435\u0438”,“price”: “12 000”},{“MIGX_id”:“4”,“time”:“90 \u043c\u0438\u043d”,“title”:“”,“description”:“”,“name”:“\u0417\u043e\u043d\u0430 \u043b\u0438\u0446\u0430 + \u0448\u0435\u044f”,“price”:“20 000”},{“MIGX_id”: “5”,“time”:“60 \u043c\u0438\u043d”,“title”:“”,“description”:“”,“name”:“\u0417\u043e\u043d\u0430 \u0434\u0435\u043a\u043e\u043b\u044c\u0442\u0435”,“price”:“10 000”},{“MIGX_id”: “6”,“time”:“120 \u043c\u0438\u043d”,“title”:“”,“description”:“”,“name”: “\u0417\u043e\u043d\u0430\u043b\u0438\u0446\u0430 + \u0448\u0435\u044f + \u0434\u0435\u043a\u043e\u043b\u044c\u0442\u0435”, “price”: “27 000”},{“MIGX_id”:“7”,“time”:“45 \u043c\u0438\u043d”,“title”:“”,“description”:“”,“name”:“\u0417\u043e\u043d\u0430 \u0433\u043b\u0430\u0437”,“price”:“8 000”},{“MIGX_id”:“8”,“time”: “60 \u043c\u0438\u043d”,“title”:“”,“description”:“”,“name”:“\u041e\u0434\u043d\u0430 \u0437\u043e\u043d\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435”,“price”:“20 000”},{“MIGX_id”:“9”,“time”: “60 \u043c\u0438\u043d”,“title”:“”,“description”:“”,“name”: “\u041f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u0430\u044f \u0448\u043b\u0438\u0444\u043e\u0432\u043a\u0430”,“price”:“14 000”}]

This kind of issue causes problems with polylang translator to other languages and it's not normal (out of the box it wasn't like this)

I've been observing this for a long time on different sites.

php 7.4
modx 2.8.6-pl
migx - 3.0.2-beta1
mysql - utf8_general_ci
modx_site_tmplvar_contentvalues - utf8_general_ci

https://qna.habr.com/q/1344376

the branch with answers on another resource *can be viewed through a translator

@halftrainedharry
Copy link
Contributor

mysql - utf8_general_ci
modx_site_tmplvar_contentvalues - utf8_general_ci

Try using a different charset in your database. One with "utf8mb4".
"utf8" only uses 3 bytes and is not a real UTF-8 charset.

@modx-developer
Copy link
Author

mysql - utf8_general_ci
modx_site_tmplvar_contentvalues - utf8_general_ci

Try using a different charset in your database. One with "utf8mb4". "utf8" only uses 3 bytes and is not a real UTF-8 charset.

for all tables in the database or just for the database?

@halftrainedharry
Copy link
Contributor

halftrainedharry commented Apr 28, 2024

Charsets in MySQL are somewhat convoluted. I believe every text column can have its own charset and changing the overall charsets of the database won't change the already existing columns.
For a MIGX-TV value, the relevant column is the column value of the database table modx_site_tmplvar_contentvalues.

Maybe try setting up a completely new MODX test installation with "utf8mb4" for everything, just to see if this resolves your issue (before tinkering with an existing database).

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