Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

SOLVED: Permalinks don't work with cp1251

Permalinks do not work with the cp1251 codepage, using Russian news tiotles, instead of link to the news I have link to news nainpage.
Tomorrow I'll try to make localization in UTF-8 and I'll report about results.
With UTF-8 doesn't work too...
I don't know why... until i see this.

https://github.com/php-fusion/PHP-Fusion/blob/7.03/includes/rewrites/custom_pages_rewrite_include.php#L21-L22

Our repo is in still in 8.00 mode!! Git wrong file.. (bang head).

You can make changes as follow to your core without downloading from Github.

CodeDownload  

$pattern = array("pages/%page_id%/%page_title%" => "infusions/custom_pages/viewpage.php?page_id=%page_id%");



to

CodeDownload  

$pattern = array("pages/%page_id%/%page_title%" => "viewpage.php?page_id=%page_id%");



Customization of all SEO rules.

CodeDownload  

$pattern = array("superman/batman/show-%page_id%/spiderman/%page_title%" => "viewpage.php?page_id=%page_id%");



To make change:

1. Uninstall old Custom Page and reinstall. Clear browser Cache. Not cookie, but cache. Hard refresh after that.
There, committed

https://github.com/php-fusion/PHP-Fusion/commit/0009735633cb27ca08e14e0bbf561a04d9e4deba

Please check and tell me if still got problem?
OK, I'll check after 12UTC, now I work.
Hien, doesn't work. And, as I can see, it work good with latin titles, but doesn't work with cyrillic (Russian, Ukrainian, Belarusian) titles. Both, news and pages.

Quote

I don't know why... until i see this.
https://github.com/php-fusion/PHP-Fusion/blob/7.03/includes/rewrites/custom_pages_rewrite_include.php#L21-L22

- by hien


For solution of this problem I propose next simple way:
Add to "/locale/LANGUAGE/global.php" file new constant winth symbols from national alphabet and merge this expressions.
Multilocale on seo url?

like this?
You do not have access to view attachments
Hien, yes. UTF-8 allows use multilocale.
And second variant:
CodeDownload  
$regex = array(
  "%cp_id%" => "([0-9]+)",
  "%cp_title%" => $locale['alphabet'],
);


And add new constant in "/locale/LANGUAGE/global.php":
CodeDownload  
$locale['alphabet'] = "([a-zA-Z0-9-_]+)";

I found issues with Scandinavian letters and iconv,
I disabled iconv and I added the \w switch that is suppose to follow the lc_locale settings,
all Scandinavian letters are now OK
You can try the update : https://github.com/php-fusion/PHP-Fusion/commit/79473b427c96763089b4fc8f6d66867880d3be4f
Not sure if it is "OK" yet, but sure works for Scandinavian. Any input appreciated.
Domi, doesn't work. This solution removes Cyrillic letters from URL. One link which contains Cyrillic and Latin letters is "trimmed" to Latin only and works. Other, with Cyrillic only doesn't work, it's "trimmed" to empty text.
IMHO, main problem - hardcoded character set. This solution not allows to specify national alphabet (not Cyrillic only - may be Arabic, Japan, Korean etc.).
As variant - add "news_firendly_url" to news table (like WordPress). User will be able to specify URL and even set link format to "/news/%news_friendly_url%", without ID.
Check your DB_Alias table, its there .. try adding it manually because Admin Panel supplied to me by Ankur doesn't install any Alias at this moment.

INSERT INTO "DB_ALIAS." (???, ??? please check) VALUES ('somefancyurl", "news.php?news_id=1".. );

But you need 1 alias per page of news - when you have MANY applications in one installation, unlike wordpress just a simple blog - things gets very very messy and DB gets very very big. That is a fair note here.

But still, I don't think alias can solve your problem, the preg_match in the permalink is the cause in my opinion. We somehow need to set system locale, then change the method the preg_match works. PHP is by nature of it is quite bad at supporting non-utf chars from what I hear and they are looking at fixing this problem with PHP 6 -- ?
It works fully for me on my tests with Scandinavian letters, I could need some more tests with non lation chars.
It should read the lc_locale setting, it need to be correct.
Domi, I don't see DB_ALIAS table... And "/includes/multisite_include.php" doesn't not contain info about it.
First , I do not know why we take up the alias here, it has nothing to do with the issue at hand.
It´s a whole different story to figure that one out.
That is a hub, we need a generator script for it. What I understand, it enabled us to match vs DB ID directly rather than using site.com/ID/NEWS/title, so it would become site.com/title. But this is an unexplored function ATM.

Anyway, multisite_include.php have DB_PERMALINK_ALIAS and that is the correct one.

To get back to the problem at hand,

With Scandinavian letters, I had the exact same issue as you describe, we use special chars such as Å Ä Ö and these were simply removed in URL conversions.
I have seen both Drupal and WP have similar issues.
They are either replacing their special chars with - or downgraded to closest Latin char, Å > A , Ö > O etc...
I do not like that solution, not at all.
In fact this have bothered me for weeks, because we can today even have special chars in Domain names ( most hosts around here support this ).
Naturally we need to deliver a SEO / SEF Engine that can translate our titles to the language we use.
By adding \w switch and turning off iconv the Engine should talk to your lc_locale setting and translate a-z for your charset.. do not go UTF-8.
This works in my labs.

Please see the other file, I made changes in two place, I forgot to mention the switch rule for the actual rewrite rule sets.

First , https://github.com/php-fusion/PHP-Fusion/commit/89324133e3d0c0aeca0318133b017d76d6db49ae
Second , https://github.com/php-fusion/PHP-Fusion/commit/79473b427c96763089b4fc8f6d66867880d3be4f

What I don´t know is if this is OK, I mean if it will cause issues when crawling pages for Search engines and that´s why it is so seldom seen with transated URL´s to native languages.
The same :( .

Quote

This solution removes Cyrillic letters from URL. One link which contains Cyrillic and Latin letters is "trimmed" to Latin only and works. Other, with Cyrillic only doesn't work, it's "trimmed" to empty text.

I propose next. If you want I can create test copy of site with English interface but in cp1251 and make you superadmin. I'll and content in Russian, Ukrainian and Belarusian languages (with specific for these languages letters) for testing.
You do not have access to view attachments
It is tricky..
But use the latest updates I made.
Then open your locale folder, global.php

// Do this with Linux hosting
setlocale(LC_ALL, 'ru_RU.UTF-8'wink; // Linux
$locale['charset'] = "windows-1251"
OR
setlocale(LC_ALL, 'ru_RU.CP1251'wink; // Linux Server (Windows may differ)
$locale['charset'] = "windows-1251";

// Do this with Windows hosting
// Locale Settings
setlocale(LC_ALL, 'russian'wink; // Windows
$locale['charset'] = "iso-8859-1";
OR
$locale['charset'] = "windows-1251";

Let me know what happens..
Results:

Quote

setlocale(LC_ALL, 'ru_RU.UTF-8'); // Linux

Links a correct, post displays correct too (site in cp1251), but I cannot open any post - 404.

Quote

setlocale(LC_ALL, 'ru_RU.CP1251'); // Linux Server (Windows may differ)

The same:

Quote

This solution removes Cyrillic letters from URL. One link which contains Cyrillic and Latin letters is "trimmed" to Latin only and works. Other, with Cyrillic only doesn't work, it's "trimmed" to empty text.


Quote

setlocale(LC_ALL, 'russian'); // Windows
$locale['charset'] = "iso-8859-1";

It's correct? iso-8859-1 for Russian?

Quote

Links a correct, post displays correct too (site in cp1251), but I cannot open any post - 404.


The fixes are only for news titles atm, the other links / posts should not work until the handlers have been updated such as news was.

Can you confirm that the News work?

Quote

Can you confirm that the News work?
- by Domi


Yes, I worked it with news. I wrote above that with UTF-8 links are correct - with Cyrillic letters.
Thread Information
Author
Replies
26 posts
Views
2,335 times
Last Post
Last updated on 5 years ago
You can view all discussion threads in this forum.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You cannot download attachments in this forum.