Skip Menu |

This queue is for tickets about the HTML-Truncate CPAN distribution.

Report information
The Basics
Id: 104212
Status: new
Priority: 0/
Queue: HTML-Truncate

People
Owner: Nobody in particular
Requestors: carlos.rodriguez [...] otrs.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Truncate an HTML entity also truncate the entity
Date: Mon, 4 May 2015 13:31:15 -0500
To: bug-HTML-Truncate [...] rt.cpan.org
From: Carlos Rodríguez <carlos.rodriguez [...] otrs.com>
If you set to truncate to a certain amount of characters and there is an entity in the truncating point it is also truncated e.g. "&oacute;" could be truncated to "&oacu…”, here is how I workaround the issue: @@ -383,7 +383,11 @@ sub truncate { { next TOKEN if $token->[2]; # DATA # my $txt = HTML::Entities::decode($token->[1]); - my $txt = $token->[1]; +# --- +# Patched by OTRS + # my $txt = $token->[1]; + my $txt = HTML::Entities::decode($token->[1]); +# --- my $current_length = 0; unless ( first { $_ eq 'pre' } @tag_q ) # We're not somewhere inside a <pre/> { @@ -427,6 +431,11 @@ sub truncate { else { $keep = substr($txt, 0, $chars_to_keep); +# --- +# Patched by OTRS + + $keep = $self->utf8_mode ? $keep : HTML::Entities::encode($keep); +# --- } if ( my $cleaner = $self->cleanly ) ((enjoy)) Carlos Rodríguez
Download signature.asc
application/pgp-signature 495b

Message body not shown because it is not plain text.