Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] my_substr(): Problem with umlauts [C-Imad Jomaa]
#1
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)
   
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#2
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.
#3
It should be "Pfannkuchen mit roter Soße" and "Überbackene Chiabattabrötchen".
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#4
Works fine here
#5
I was facing the same thing when the mbstring module is not enabled
Official Arabic Translator.
#6
I'll ask the user who reported this issue about that.
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#7
You're right, the mbstring module is not enabled on his host.
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#8
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
#9
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.

Ryan
#10
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)