Fixed German umlaut preservation in URLs in XenForo 2.3 is broken

Steffen

Well-known member
Affected version
2.3.2
First of all, thank you for the german umlaut preservation in URLs in XenForo 2.3 explained here: https://xenforo.com/community/threa...haracters-such-as-o-and-u.221332/post-1681545 :)

However, there seems to be a small but crucial bug which causes the special-casing to not be used. The code expects the locale separator to be and underscore (i.e. "de_DE") although actually it is a dash ("de-DE").

Diff:
--- a/src/XF/Util/Str.php
+++ b/src/XF/Util/Str.php
@@ -385,7 +385,7 @@ class Str
 
    protected static function getLocale(string $languageCode): string
    {
-       $parentLocale = strrchr($languageCode, '_');
+       $parentLocale = strrchr($languageCode, '-');
 
        if (!$parentLocale)
        {
 

Attachments

  • Screenshot from 2024-08-19 10-19-43.webp
    Screenshot from 2024-08-19 10-19-43.webp
    95.5 KB · Views: 11
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.3).

Change log:
Fix determining locale from language code for string manipulation
There may be a delay before changes are rolled out to the XenForo Community.
 
Correct, this error is related to the one mentioned. I made a correction to the Str.php file, and the transliteration started to display... more or less correctly.
 
Affected version: 2.3.3

I fixed the bug by changing
Code:
/src/XF/Util/Str.php
as shown by @Steffen for version 2.3.2.

However, after upgrading to 2.3.3 the false behaviour turns up again. In particular "ä" is replaced by "a" instead of "ae" as before which means that all old URLs containing at least one umlaut are changed.

As
Code:
$parentLocale = strrchr($languageCode, '-');
is included in Str.php in 2.3.3 the problem seems to arise from another part of the code now.

Can someone please reopen the ticket and provide a workaround similar to the one from #1? Thanks!
 
Back
Top Bottom