[Typo3-dev] crop whole words and utf-8

Elmar Hinz elmar.hinz at vcd-berlin.de
Fri Nov 11 14:49:20 CET 2005


Toni Milovan wrote:
> I was just looking at API doumentation and there is:
> 
> 01414         function crop($charset,$string,$len,$crop='')   {
> 01415                 if (intval($len) == 0)  return $string;
> 01416 
> 01417                 if ($charset == 'utf-8')        {
> 01418                         $i = $this->utf8_char2byte_pos($string,$len);
> 01419                 } elseif ($this->eucBasedSets[$charset])        {
> 01420                         $i = $this->euc_char2byte_pos($string,$len,$charset);
> 01421                 } else {
> 01422                         if ($len > 0)   {
> 01423                                 $i = $len;
> 01424                         } else {
> 01425                                 $i = strlen($string)+$len;
> 01426                                 if ($i<=0)      $i = false;
> 01427                         }
> 01428                 }
> 
> Shouldn't this take care of the utf-8 problem?
> 

It looks so.

But what if $charset contains "UTF-8" instead of "utf-8" for any reason?
(I don't say it does. It probaly does not.)

Elmar

-- 
Climate change 2005: Mexico, Guatemala, New Orleans, Sahel, Bangladesh,
Spain, Portugal, Austria, Swiss, France, ...
Production of CO2 is killing people.
Production of CO2 just for fun is killing people just for fun.




More information about the TYPO3-dev mailing list