Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

utf8 modifier plugin

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
thiebo
Smarty Pro


Joined: 16 Jan 2005
Posts: 144
Location: Paris

PostPosted: Mon Oct 24, 2005 5:57 pm    Post subject: utf8 modifier plugin Reply with quote

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
View user's profile Send private message Visit poster's website
thiebo
Smarty Pro


Joined: 16 Jan 2005
Posts: 144
Location: Paris

PostPosted: Mon Oct 24, 2005 6:05 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP