Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] my_substr(): Problem with umlauts [C-Imad Jomaa]
MyBB 1.4.4 includes a fix for a problem with unicode characters and the my_wordwrap() function (Bug #40223).

Something similar seems to appear in the my_substr() function: If an unicode character (e.g. an umlaut) is the last character it gets messed up.

Attached Files Thumbnail(s)
[Image: donation_drive_sig.png]
Can you copy and paste what it should be here so I can reproduce on my own localhost?

I think these are two separate issues.
It should be "Pfannkuchen mit roter Soße" and "Überbackene Chiabattabrötchen".
[Image: donation_drive_sig.png]
Works fine here
I was facing the same thing when the mbstring module is not enabled
Official Arabic Translator.
I'll ask the user who reported this issue about that.
[Image: donation_drive_sig.png]
You're right, the mbstring module is not enabled on his host.
[Image: donation_drive_sig.png]
I think we can pretty much state in the requirements that mbstring is needed for internationalization forums if they want 100% support for multi-byte characters
I'll mark this as not fixable unless anyone else has a brilliant idea to be able to use the "u" modifier with preg and not screw it up for forums that don't support that. The one way to tell that I know of is to:

count the number of ? marks in the original string. run the preg function with "u" and count the number of ? marks afterward. If they're not the same then we know it doesn't support it and it runs the preg without the "u" modifier. The problem with that is that it's really crappy and your doing twice the processing for just one preg sometimes.

I guess the other solution is to run a test on the upgrade / installation, but I don't know if that'll be guaranteed to be correct. However if we could get that to work we can just do an

function my_preg_replace(...) { if($mybb->settings['preg_unicode'] == 1) { preg...with...unicode } else { preg...without...unicode } return string }

So I'm hoping for someone with a good idea.

This user has been denied support. This user has been denied support.
Making it a setting seems the best idea to me, maybe combined with a fallback to the non-unicode variant if the unicode one throws an error or returns nothing, so it doesn't break completely if preg_unicode is set to 1 and the server removes support for it.

Forum Jump:

Users browsing this thread: 1 Guest(s)