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

Issue with slugs in Cyrillic #1156

Closed
bagaweb opened this issue Apr 28, 2022 · 22 comments
Closed

Issue with slugs in Cyrillic #1156

bagaweb opened this issue Apr 28, 2022 · 22 comments

Comments

@bagaweb
Copy link

bagaweb commented Apr 28, 2022

I noticed an issue with latest experimental qTranslate-XT (with slugs module included):

when Russian language is enabled, Cyrillic slugs give 404 error.

If the slugs are in Latin characters (for example apartamenty instead of апартаменты), there are no issues.

It was working ok with qTranslate-XT 3.11.4 and qTranslate slug 1.1.8.

Anyone else noticed this bug?

@spleen1981
Copy link
Contributor

It was working ok with qTranslate-XT 3.11.4 and qTranslate slug 1.1.8.

This should be broken since WP 4.8.3 due to a breaking change with esc_sql()

Fixed by #1157.

@herrvigg
Copy link
Collaborator

herrvigg commented May 2, 2022

@bagaweb Fix merged in master, please let us know if this also works on your side.

@bagaweb
Copy link
Author

bagaweb commented May 3, 2022

Just trying the last update but unfortunately still 404 on the Russian version, actually now 404 errors are also in English and German version which are in Latin characters.

@spleen1981
Copy link
Contributor

I can't reproduce, it is working good with my test configuration...
Can you try to:

  • double check slugs module activation status (maybe disable and enable again to be sure)
  • update permalinks settings as explained here
  • update the test post before trying or test with a fresh one

@herrvigg
Copy link
Collaborator

herrvigg commented May 4, 2022

I'd like to release the new version but this part is blocking the release.
What are the steps and the config required to reproduce?

@spleen1981
Copy link
Contributor

@herrvigg to test this just set something like пробный as an alternate language slug for a post/page, with slugs module activated, and try to reach the url.

@herrvigg
Copy link
Collaborator

herrvigg commented May 7, 2022

Good, it seems to works fine.

@bagaweb If it fails for other languages the issues are most likely not due to Slugs and not even QTX. Perhaps some problem with URL rewrites in your web server (Apache, nginx, ...).
Try to disable all and see if WP works with raw values. Then reactivate QTX and see where it fails. With QTX be sure you use the correct URL values before the custom slug values, according to the URL mode.

@herrvigg
Copy link
Collaborator

herrvigg commented May 7, 2022

I can also confirm that fix is doing the job.

  • If I go back before fix (git checkout f3889ab02d495969378fbbb837343680e3a82ff4) I can reproduce the error. Page not found.
  • With the fix the problem disappears.

@bagaweb
Copy link
Author

bagaweb commented May 11, 2022

Hello @herrvigg & @spleen1981 I'm back to testing and still getting the same error with latest master.

Anyway I tried to change permalinks settings and here's the weird result:

  • day & name (/%year%/%monthnum%/%day%/%postname%/) works fine;
  • month & name (/%year%/%monthnum%/%postname%/) works fine;
  • numeric (/archives/%post_id%) works fine;
  • post name (/%postname%/) doesn't work (404 errors in all languages except main language).

I tried to deactivate all other plugins to check if there was a conflict, still same problem.

@spleen1981
Copy link
Contributor

@bagaweb tried with /%postname% and still works on my test configuration.
Maybe you could provide your configuration details from QTX settings > Troubleshooting > Collect information in order to try to replicate the issue.

@bagaweb
Copy link
Author

bagaweb commented May 13, 2022

Here we go @spleen1981

{ "PHP_VERSION": "7.4.3", "WP_VERSION": "5.9.3", "QTX_VERSION": "3.11.4", "Plugins": [ "Advanced Database Cleaner 3.0.4", "All in One SEO 4.2.0", "Autoptimize 3.0.4", "Classic Editor 1.6.2", "Insert Pages 3.7.3", "ja.do Swiper Gallery Slider 1.5", "qTranslate-XT 3.11.4", "Theme Check 20211203", "Advanced Editor Tools (previously TinyMCE Advanced) 5.6.0", "WP Sitemap Page 1.9.1" ] }

{ "default_language": "it", "enabled_languages": [ "it", "en", "de", "ru" ], "flag_location": "themes/example.com/img/flags/", "language_name": { "it": "Italiano", "en": "English", "de": "Deutsch", "ru": "Русский" }, "locale": { "it": "it_IT", "en": "en_US", "de": "de_DE", "ru": "ru_RU" }, "locale_html": { "it": "", "en": "", "de": "", "ru": "" }, "not_available": { "it": "Ci spiace, ma questo articolo è disponibile soltanto in %LANG:, : e %.", "en": "Sorry, this entry is only available in %LANG:, : and %.", "de": "Leider ist der Eintrag nur auf %LANG:, : und % verfügbar.", "ru": "Извините, этот текст доступен только на “%LANG:”, “:” и “%”." }, "date_format": { "it": "%e %B %Y", "en": "%A %B %e%q, %Y", "de": "%A, \\d\\e\\r %e. %B %Y", "ru": "%A %B %e%q, %Y" }, "time_format": { "it": "%H:%M", "en": "%I:%M %p", "de": "%H:%M", "ru": "%H:%M" }, "flag": { "it": "it.png", "en": "gb.png", "de": "de.png", "ru": "ru.png" }, "url_mode": 2, "use_strftime": 3, "filter_options_mode": 0, "language_name_case": 0, "detect_browser_language": true, "hide_untranslated": false, "show_displayed_language_prefix": true, "show_alternative_content": false, "hide_default_language": true, "use_secure_cookie": false, "header_css_on": false, "header_css": ".qtranxs_flag_it {background-image: url(http://localhost/example.com/wp-content/plugins/qtranslate-xt/flags/it.png); background-repeat: no-repeat;}\r\n.qtranxs_flag_en {background-image: url(http://localhost/example.com/wp-content/plugins/qtranslate-xt/flags/gb.png); background-repeat: no-repeat;}\r\n", "text_field_filters": [], "term_name": [], "disable_client_cookies": false, "ignore_file_types": [ "gif", "jpg", "jpeg", "png", "svg", "pdf", "swf", "tif", "rar", "zip", "7z", "mpg", "divx", "mpeg", "avi", "css", "js", "mp3", "mp4", "apk" ], "url_info": { "cookie_lang_front": "it", "cookie_lang_admin": "en", "cookie_front_or_admin_found": true, "scheme": "http", "host": "localhost", "path": "/example.com/wp-admin/admin-ajax.php", "query": "action=admin_debug_info", "path-base": "/example.com", "wp-path": "/wp-admin/admin-ajax.php", "language_neutral_path": true, "http_referer": "http://localhost/example.com/wp-admin/options-general.php?page=qtranslate-xt", "referer_admin": true, "doing_front_end": false, "lang_cookie_admin": "en", "lang_admin": "en", "language": "en", "set_cookie": false }, "language": "en", "editor_mode": 0, "highlight_mode": 1, "auto_update_mo": true, "hide_lsb_copy_content": false, "lsb_style": "Simple_Tabs.css", "config_files": [ "./i18n-config.json" ], "custom_i18n_config": [], "custom_fields": [], "custom_field_classes": [], "post_type_excluded": [ "post", "attachment", "custom_css", "customize_changeset", "oembed_cache", "user_request", "wp_block" ], "admin_enabled_modules": { "all-in-one-seo-pack": true, "slugs": true, "acf": false, "events-made-easy": false, "jetpack": false, "google-site-kit": false, "gravity-forms": false, "woo-commerce": false, "wp-seo": false }, "translator": {}, "qtrans_compatibility": false }

{ "cookies": [], "navigator": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.1.4896.80 Decentr Safari/537.36" }

@herrvigg
Copy link
Collaborator

herrvigg commented May 13, 2022

I also use %postname% for the permalinks.
The settings looks quite similar to the one I have (URL mode = 2 ) except for the WP paths

    "scheme": "http",
    "host": "localhost",
    "path": "/wp-admin/admin-ajax.php",
    "query": "action=admin_debug_info",
    "path-base": "",
    "wp-path": "/wp-admin/admin-ajax.php",
    "language_neutral_path": true,
    "http_referer": "http://localhost/wp-admin/options-general.php?page=qtranslate-xt",

I don't know if this has an impact but your path-base is /example.com and in my case it's empty. Also your wp-path is not starting with /wp-admin but it has the path-base prefix. Is it something that changed recently?

If you disable the slugs module and use the slugs plugin, does it work?

@spleen1981
Copy link
Contributor

@bagaweb I tried to replicate your configuration, including the example.com subfolder structure, "post_type_excluded":[ "post", (is that intended?), same QTX submodules, etc.
Slugs are working fine on my test, both with latin and UTF8 characters, hence root cause must be somewhere else, hard to say without debugging your test configuration.
If with f3889ab slugs were working except for UTF8 and with 6031efa slugs were not working at all, you should check what is happening here up to the query is sent. No other changes between the two commits.
If query returns the correct result, QTX/QTS can be excluded from the causes.

@spleen1981
Copy link
Contributor

@bagaweb ok I found something, maybe you forgot to mention that issue is specific to pages (while I was focused on posts).
Should be fixed with #1168.

You can try this branch to confirm if it is working now.

@herrvigg
Copy link
Collaborator

maybe you forgot to mention that issue is specific to pages

Good finding! Was that a regression specific to the modules? Since when?

@spleen1981
Copy link
Contributor

Good finding! Was that a regression specific to the modules? Since when?

Yes, since 08c6881

@bagaweb
Copy link
Author

bagaweb commented May 16, 2022

@bagaweb ok I found something, maybe you forgot to mention that issue is specific to pages (while I was focused on posts). Should be fixed with #1168.

You can try this branch to confirm if it is working now.

Excellent @spleen1981 I can confirm it is working great with pages, both with Latin and Cyrillic characters.
Yes I forgot to mention it was related to pages and not to posts.

I made a test on another project which uses custom post types as well and that's what happens:

  • example.com/ru/книга/библия -> 404
  • example.com/ru/kniga/библия -> works

It's the same behaviour as with the old slugs plugin.

@spleen1981
Copy link
Contributor

@bagaweb can you clarify what are exactly книга (base for what?) and библия (post, page, custom post type?)

@bagaweb
Copy link
Author

bagaweb commented May 16, 2022

It was just an example, книга (book in English) is the post type slug, and библия (Bible in English) is the CPT title.

Italian example:

  • example.com/it/libro/bibbia (where libro is the post type slug in Italian)

@spleen1981
Copy link
Contributor

We need to know exactly what are those to replicate the issue... can you send a screen of slug settings page where you set the slug base?
The target (last slug) is a post, a page or a custom post type? It is generated from any plugin? Please provide as much details as possible as a general rule.

@spleen1981
Copy link
Contributor

@bagaweb can you try again with the same branch above which has a new specific commit to address this utf8 issues?
Rewrite rules needs to be flushed before trying (go to settings>permalinks and save).

@bagaweb
Copy link
Author

bagaweb commented May 17, 2022

@bagaweb can you try again with the same branch above which has a new specific commit to address this utf8 issues? Rewrite rules needs to be flushed before trying (go to settings>permalinks and save).

I confirm that everything works perfectly with this new fix @spleen1981, pages, posts and custom post types, thanks a lot for your work!

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