[Typo3-dev] crop whole words and utf-8
Toni Milovan
tmilovan at efpu.hr
Fri Nov 11 14:40:28 CET 2005
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?
Thanks,
TOni
On Pet, 2005-11-11 at 13:07 +0100, Wolfgang Klinger wrote:
> Hi!
>
> On Fri, 11 Nov 2005, Toni Milovan wrote the following:
> > Now, Im using the utf-8 charset and after discussion on typo userlist we
> > concluded that problem is probably in utf-8 being multibyte enconding.
> >
> > I'm interested (if that is the case) has this problem been solved in
> > development versions and is that problem solveable at all?
>
> The used standard "substr" function is not multi-byte safe.
>
> So I suggest to post this as a bug report.
> Either we use one of those mb_* functions
> http://at2.php.net/manual/en/function.mb-substr.php
> which requires PHP built with --enable-mbstring
> or one of the several available selfmade solutions like
> http://at2.php.net/manual/en/function.substr.php#53200
>
>
> kind regards
> Wolfgang
>
> _______________________________________________
> Typo3-dev mailing list
> Typo3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
--
Toni Milovan <tmilovan at efpu.hr>
More information about the TYPO3-dev
mailing list