|
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 |
thiebo Smarty Pro
Joined: 16 Jan 2005 Posts: 144 Location: Paris
|
Posted: Mon Oct 24, 2005 5:57 pm Post subject: utf8 modifier plugin |
|
|
Nothing really special here, but I'll post it for people in the same situation like me, having all scripts encoded in utf_8, but retreiving arrays from mysql in latin1 (for some strange reason since the mysql table is encoded in utf8). I've seen the problem on some php forums, so I hope it's helpful to someone :
modifier.utf.php :
[php:1:4dc3ecf97b] 1 <?php
2 function smarty_modifier_utf ($string)
3 {
4 $utf = utf8_encode ($string);
5 //that's all folks !
6 }
7 ?>[/php:1:4dc3ecf97b]
use :
Code: | {section name=i loop=$chercheurs}
{$chercheurs[i].Nom_Auteur|utf}<p />
{/section} |
Thiebo |
|
Back to top |
|
thiebo Smarty Pro
Joined: 16 Jan 2005 Posts: 144 Location: Paris
|
Posted: Mon Oct 24, 2005 6:05 pm Post subject: |
|
|
Sorry, correct code is :
modifier.utf.php :
[php:1:f35a74cfd3] 1 <?php
2 function smarty_modifier_utf ($string)
3 {
4 $utf = utf8_encode ($string);
5 return $utf;
6 }
7 ?>
[/php:1:f35a74cfd3] |
|
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
|