CMS MADE SIMPLE FORGE

TinyMCE

 

[#5775] Ver. 2.8.2 - Substr in cmslinker causes UTF issues

avatar
Created By: Sofia Hauschildt (sonya)
Date Submitted: Mon Nov 29 13:34:23 -0500 2010

Assigned To: Morten Poulsen (silmarillion)
Version: None
CMSMS Version: None
Severity: Major
Resolution: Accepted
State: Closed
Summary:
Ver. 2.8.2 - Substr in cmslinker causes UTF issues
Detailed Description:
Cmslinker does not show the menu items in TinyMCE, if the menu text too long.
See TinyMCE.module.php

if (strlen($menutext) > 30) {
$menutext = htmlspecialchars(substr($menutext, 0, 30), ENT_QUOTES,
'UTF-8') . " …";
    } else {
      $menutext = htmlspecialchars($menutext, ENT_QUOTES, 'UTF-8');
    }

There are 2 problems with this code. strlen() does not work proper with utf8
stings. The second issue is substr() that corrupts the menu text and as result,
nothing (except of ...) is shown in cmslinker.


History

Comments
avatar
Date: 2010-11-29 15:52
Posted By: Morten Poulsen (silmarillion)

accepted and confirmed
      
avatar
Date: 2010-11-29 16:04
Posted By: Morten Poulsen (silmarillion)

fixed in svn
      
avatar
Date: 2010-12-23 13:49
Posted By: Sofia Hauschildt (sonya)

This bug is not fixed completely. strlen() seems to work correctly in the code
below:

    if (strlen(utf8_decode($menutext)) > 30) {
$menutext = htmlspecialchars(utf8_encode(substr(utf8_decode($menutext), 0,
30)), ENT_QUOTES, 'UTF-8') . " …";
    } else {
      $menutext = htmlspecialchars($menutext, ENT_QUOTES, 'UTF-8');
    }

However, after substr() is applied the long menu text is now substituted with
questions marks. See the screenshot
http://forum.cmsmadesimple.org/index.php?action=dlattach;topic=50316.0;attach=9349;image
      
avatar
Date: 2010-12-25 07:53
Posted By: Morten Poulsen (silmarillion)

It's strange, I cannot reproduce this problem with Danish special UTF-8 chars.
It works perfectly. Could you past an example of the Russian text here, and I'll
try to paste it into my setup and see if that triggers the error...?
I'll do my best to fix this!

m.
      
avatar
Date: 2010-12-25 08:04
Posted By: Sofia Hauschildt (sonya)

Morten, I tried to debug it and do not  really understand myself. An example for
long broken menu text is:

Примеры визуальной коррекции формы лица


      
avatar
Date: 2012-04-04 19:03
Posted By: Morten Poulsen (silmarillion)

Is this still a problem, or can I close it?
      
avatar
Date: 2016-02-12 13:19
Posted By: Rolf (rolf1)

TinyMCE version 3.x is released, the module is a complete rewrite of all code.

Because of this, bug reports related to the old version are not relevant anymore
and will be closed. Please use the latest and finest release at your CMSMS 2.x
website and test again. If you feel like your issue still isn't fixed create a
new report. Thanks.
      
Updates

Updated: 2016-02-12 13:19
cmsms_version_id: => -1
state: Open => Closed

Updated: 2010-12-23 13:49
summary: Ver. 2.8.1 - Substr in cmslinker causes UTF issues => Ver. 2.8.2 - Substr in cmslinker causes UTF issues

Updated: 2010-12-23 13:49
state: Closed => Open

Updated: 2010-11-29 16:04
state: Open => Closed

Updated: 2010-11-29 15:52
resolution_id: => 6
assigned_to_id: 100 => 113