♥raiwa Posted November 20, 2015 Posted November 20, 2015 Trying to update the sloppy words cleaner add-on, I replaced the e modifier by preg_replace_callback. Example: if ($all_uppercase) { // capitalize acronymns and initialisms i.e. PO $str = preg_replace("/\\b($all_uppercase)\\b/e", 'mb_strtoupper("$1", CHARSET)', $str); } Replaced by: if ($all_uppercase) { // capitalize acronymns and initialisms i.e. PO $str = preg_replace_callback( "/\\b($all_uppercase)\\b/", function ($m) { return mb_strtoupper($m[1], CHARSET); }, $str ); } It all works correct except for the character encoding. Adding "CHARSET" to the mb_strtoupper function worked in the old version, but doesn't work within the preg_replace_callback function. I tried also with "utf-8" and 'utf-8' instead of CHARSET. Any ideas?? Thanks Rainer About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets
♥kymation Posted November 20, 2015 Posted November 20, 2015 Try with 'UTF-8'. It's apparently case sensitive. Regards Jim See my profile for a list of my addons and ways to get support.
♥raiwa Posted November 20, 2015 Author Posted November 20, 2015 Yes, tried already,same result. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets
♥kymation Posted November 21, 2015 Posted November 21, 2015 Try mb_convert_case($m[1], MB_CASE_UPPER, 'UTF-8'); in place of the mb_strtoupper() function. Regards Jim See my profile for a list of my addons and ways to get support.
♥raiwa Posted November 21, 2015 Author Posted November 21, 2015 Hello Jim @@kymation, That did it :thumbsup: Thank you so much About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets
♥kymation Posted November 21, 2015 Posted November 21, 2015 That's a really old bug in PHP. I thought it was fixed long ago, but apparently not. Good thing it worked, because I was running out of things to suggest. Regards Jim See my profile for a list of my addons and ways to get support.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.