Character encoding using lang() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Character encoding using lang() (/showthread.php?tid=25013) |
Character encoding using lang() - El Forum - 11-27-2009 [eluser]rossmurphy[/eluser] Hi all, I am using the language helper for a multilingual site. I am finding that in my language files i have to use this: Code: $lang['label.category.payment'] = '<span class="bold">Tarjeta de Crédito y Débito</span>'; Instead of this: Code: $lang['label.category.payment'] = '<span class="bold">Tarjeta de Crédito y Débito</span>'; However, if in the language line i don't used html i find that i dont have to character encode the text. But as you can see from the first example above, i have to encode the special chars. Has anyone run into this problem? Character encoding using lang() - El Forum - 11-27-2009 [eluser]Isern Palaus[/eluser] Hello, Yo he tenido este problema, y no tengo muy claro que es... En una aplicación sin especificar nada si ponia accentos y ñ no habia problemas. En otra tenia que usar á ñ etc. Dependerá del charset imagino :S Un saludo, Isern Character encoding using lang() - El Forum - 11-27-2009 [eluser]rossmurphy[/eluser] Not sure if your trying to make a point or explain something. Sorry forgot to mention, i don't speak spanish. Thanks Though. Character encoding using lang() - El Forum - 11-28-2009 [eluser]demogar[/eluser] He just told that could be the charset. I had the same problem before and what I did is to only use text in my language files. For example, in my view I used something like: Code: View: I think its a better practice too. Character encoding using lang() - El Forum - 12-05-2009 [eluser]rossmurphy[/eluser] I extended the lang library so that i could pass in vars and return a line with html. It also takes care of the problem i was having with special chars and html in the same lang line. Let me know how it could be improved. Code: <?php Character encoding using lang() - El Forum - 12-05-2009 [eluser]cahva[/eluser] I might not understood the actual problem but are you sure you have the right encoding in your language file? I mean for example if you have set the encoding to UTF-8, have you also saved your lang file as UTF-8? Character encoding using lang() - El Forum - 12-06-2009 [eluser]rossmurphy[/eluser] I checked my lang file and it wasn't UTF-8. Thanks a lot. That solved my issue. So here is the revised code without the trans table. Code: <?php |