|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Mindfactory Smarty n00b
Joined: 07 Jul 2010 Posts: 1
|
Posted: Wed Jul 07, 2010 9:37 am Post subject: Bug in modifier.truncate.php |
|
|
Dear Smarty-Community,
we don’t know if you already knew this bug, so we add it here for help.
in Smarty version 3 we found a bug in the file named "modifier.truncate.php"
Line 37:
$string = preg_replace('/\s+?(\S+)?$/u', '', mb_substr($string, 0, $length + 1));
The modifier "u" isn’t a good choice for the german language, because of its umlauts. (Ä, ä, Ö, ö, Ü, ü und ß).
Following you’ll find a little example:
<?php
$text = "Ä oder ä, Ö oder ö, Ü oder ü und ß. Ein Text mit Umlauten.";
$string = preg_replace('/\s+?(\S+)?$/u', '', mb_substr($text, 0, 50));
$string2 = preg_replace('/\s+?(\S+)?$/', '', mb_substr($text, 0, 50));
echo '<pre>';
print_r('Text: '.$text);
echo '</pre>';
echo '<pre>';
print_r('Ausgabe1: '.$string);
echo '</pre>';
echo '<pre>';
print_r('Ausgabe2: '.$string2);
echo '</pre>';
exit;
?>
Liebe Smarty-Community,
wir wissen nicht ob dieser Bug schon bekannt ist, deshalb melden wir ihn hier.
in Version 3 haben wir ein Bug entdeckt und zwar in der Datei "modifier.truncate.php".
Zeile 37:
$string = preg_replace('/\s+?(\S+)?$/u', '', mb_substr($string, 0, $length + 1));
Modifier "u" ist für die Deutsche Sprache nicht geeignet, da sie Umlaute (Ä, ä, Ö, ö, Ü, ü und ß) hat. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Jul 07, 2010 12:12 pm Post subject: |
|
|
Where is the problem?
"isn’t a good choice" is no valid bug report.
You missed to mention what output you expect and what output you get instead. |
|
Back to top |
|
ChrisFah Smarty Pro
Joined: 02 Nov 2009 Posts: 159 Location: Traun, Austria
|
Posted: Wed Jul 07, 2010 4:13 pm Post subject: |
|
|
Hi, möchte auch meinen Senf dazugeben, da beide ja deutsch können:
Ich seh das Problem nicht beim Modifier.
Das Problem liegt am Text, der nach der Eingabe nciht auf "german umlauts" geprüft und gegebenfalls durch &?uml; usw korrigiert wurde...
Lg, Chris |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Jul 07, 2010 4:42 pm Post subject: |
|
|
In Smarty3 we added multibyte support. But in the trucate modifer we need to check if the string is utf-8 encoded or not.
This has been fixed in the SVN now. |
|
Back to top |
|
freemylove Smarty Rookie
Joined: 20 Jul 2010 Posts: 9
|
Posted: Tue Jul 20, 2010 1:37 pm Post subject: |
|
|
thanks |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|