Welcome Guest, Not a member yet? Register   Sign In
Spanish in array not displaying correctly on page
#1

[eluser]RJ[/eluser]
Hello,

Below is the Spanish array I am using, attached to the post is a screen shot of the result. Page is UTF-8, Spanish characters display properly in the text, just not when passed through this array. Any thoughts how to fix?

Code:
$list = array(
                    'AU'=>'Australia',
                    'BR'=>'Brasil',
                    'DE'=>'Alemania',
                    'FR'=>'Francia',
                    'MX'=>'Méjico',
                    'NL'=>'Países Bajos',
                    'UK'=>'Reino Unido',
                    'US'=>'Estados Unidos de América');
#2

[eluser]SomeFunkyDude[/eluser]
Definitely an encoding issue, I'm not sure at what point it's getting mixed up, but are you able to use html entities for the special characters? http://www.w3schools.com/tags/ref_entities.asp

Joel on Software has a good article btw about encodings in case you ever have trouble sleeping http://www.joelonsoftware.com/articles/Unicode.html
#3

[eluser]RJ[/eluser]
@SomeFunkyDude
Tried the htmlentities, this function only allows string, not array. However, I used your link, replaced text with the appropriate code.. and wallah! Looks good, thank you!!
#4

[eluser]alditis[/eluser]
Hello!!!
Another solution.

codeigniter/system/application/config.php
Code:
$config['charset'] = "UTF-8";

codeigniter/system/application/views/you_view.php
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;My Title&lt;/title&gt;    
&lt;/head&gt;
&lt;body&gt;
...

Try it.




Theme © iAndrew 2016 - Forum software by © MyBB