Text Size

Login

bug text (single quote) truncated (see sample)

Use this forum to resolve problems and report bugs

bug text (single quote) truncated (see sample)

Postby fgossart » Wed 9 Oct 2013 08:47

In the website
http://www.paysdeflandre.fr/index.php/fr/plaisirs-gourmands

You can see 'la Ferme Marc Deswarte'

The categ view displays only part of text and is bad truncated
Vente d&#...

When you open the item
vente d'asperges
User avatar
fgossart
FLEXIcontent Expert
FLEXIcontent Expert
 
Posts: 218
Joined: Sat 16 Jan 2010 07:49
Location: Cassel (59)

Re: bug text (single quote) truncated (see sample)

Postby ggppdk » Wed 9 Oct 2013 15:32

Hello

UTF8 characters are 1-3 bytes,

-- FLEXIcontent text cut off function is quite smart as it detects many problems and avoids them
e.g.
it will not cut an UTF8 character halfway,
it will count string length properly,
it will add space in case of "more<some_html_tag>words" making it "more words" and not "morewords"
etc ... !!

-- in case of single quote there is a problem indeed (that is what is happening in your case)

-- you can text a fix, report back, and i will apply it to FLEXIcontent distributions:
in components/com_flexicontent/classes/flexicontent.helper.php
find about (at about line 778)
Code: Select all
// Calculate length according to UTF-8 encoding
$length = JString::strlen(htmlspecialchars( $cleantext ));

// cut the text if required
if ($chars) {
   if ($length > $chars) {
      $cleantext = JString::substr( htmlspecialchars($cleantext, ENT_QUOTES, 'UTF-8'), 0, $chars ).'...';
   }
}

and replace with

Code: Select all
// Calculate length according to UTF-8 encoding
$length = JString::strlen($cleantext);

// Cut off the text if required
if ($chars) {
   if ($length > $chars) {
      $cleantext = JString::substr( $cleantext, 0, $chars ).'...';
   }
}

// Reencode HTML special characters, (but do not encode UTF8 characters)
$cleantext = htmlspecialchars($cleantext, ENT_QUOTES, 'UTF-8');


PS: filter can be compacted if you want, also the can have more appearances than drop down selection, e.g. radios, or checkboxes or tag-like selection etc (see new filtering parameters in field configuation)

-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
User avatar
ggppdk
Lead Developer
Lead Developer
 
Posts: 9824
Joined: Tue 14 Jun 2011 22:17
Location: Crete

Re: bug text (single quote) truncated (see sample)

Postby fgossart » Thu 10 Oct 2013 15:16

It's OK now good fix Thks
User avatar
fgossart
FLEXIcontent Expert
FLEXIcontent Expert
 
Posts: 218
Joined: Sat 16 Jan 2010 07:49
Location: Cassel (59)

Re: bug text (single quote) truncated (see sample)

Postby ggppdk » Thu 10 Oct 2013 15:55

Hello

thanks for feedback (will include fix in next FC package) and for reporting this

Regards

-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
User avatar
ggppdk
Lead Developer
Lead Developer
 
Posts: 9824
Joined: Tue 14 Jun 2011 22:17
Location: Crete


Return to Troubleshooting

Who is online

Users browsing this forum: No registered users and 1 guest