Welcome Guest, Not a member yet? Register   Sign In
Problems with accents and special characters
#21

[eluser]Asinox[/eluser]
sure!! but remember...Latin1 != "Latino" jejeej, try to use alwasy utf8 and utf8_general_ci and in ur html file the chatset utf8

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


Smile
#22

[eluser]Andres Ledesma[/eluser]
Excellent! Thanks for the tip, its always good to share knowledge!

Cheers! :-)
#23

[eluser]yayot[/eluser]
Im sorry guys but I try everything you say:

$config['charset'] = "UTF-8";
$db['default']['dbcollat'] = "utf8_general_ci";

and

$db[‘default’][‘char_set’] = “latin1”;
$db[‘default’][‘dbcollat’] = “latin1_swedish_ci”;

and no luck... in my database y try collation utf8_general_ci and utf8_spanish_ci y also try

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

and

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset="UTF-8">

and nothing Im still getting this: Huérfana instead of this Huérfana, thanks for your help!!
#24

[eluser]Andres Ledesma[/eluser]
Ok, well you can try to set your database collation to "latin1_swedish_ci" instead of "utf8_spanish_ci", and of course use the same collation un your database configuration file, like this:

$db['default']['char_set'] = "latin1";
$db['default']['dbcollat'] = "latin1_swedish_ci";
As you correctly did.

Or you can try utf8, but be careful to use "utf8_unicode_ci" instead of the "utf8_general_ci" that you are currently using, and you should change your config accordingly to this:

$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_unicode_ci";

Please note that the $db['default']['char_set'] value doesn't have a hyphen (this is wrong: "utf-8").

Try the first option or the second, both should work without any trouble, but please tell us about any further problems you might face.

Regards!
#25

[eluser]TheFuzzy0ne[/eluser]
You should check to see how the characters display via phpMyAdmin or equivalent. If they display properly, then the issue is not database coding.

It might also be worth sending the encoding in a header:
Code:
header('Content-type: text/html; charset=utf-8');
#26

[eluser]yayot[/eluser]
I was about to reply exactly that... the fix for me was using the header tag : header('Content-type: text/html; charset=utf-8');

thanks TheFuzzy0ne, JoostV and vitoco
#27

[eluser]Unknown[/eluser]
SPANISH:
Tuve varios problemas similares con CI hace poco, el problema más común era que alguna data con acentos no se almacenaba correctamente en MySQL, lo cortaba en los acentos, por ejm: "frágil" lo almacenaba en MySQL como "fr", "compañero" lo almacenaba "compa", etc.

El problema con esto es que los archivos que contenían la data no estaban codificados en UTF8 sino en ANSI. CI funciona de mil maravillas, no hay que cambiar nada en el source de CI ni hacer trucos de configuración, el problema está en la data que están insertando/mostrando. Si están decididos a trabajar con UTF8 sigan estos consejos:

1- En el HEADER de su página, indiquen el Content-Type es UTF8:

Code:
<meta http-equiv="content-type" content="text/html; charset=utf8" />

2- Al cargar data en la BD, si la data viene de un archivo de texto, php o similar, asegúrense que dicho archivo está codificado en UTF8, pueden bajarse Notepad++ y seleccionar menú -> formato -> Codificar en UTF8 sin BOM.

3- Al cargar data de un formulario, asegúrense que la página de dicho formulario está en UTF8, es decir, tiene un Content-Type de UTF8.

4- Coloquen en el archivo de config "database.php" de CI:

Code:
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';

5- Coloquen los Collation (cotejamiento) de MySQL en "utf8_general_ci".

6- Para que sus páginas no se muestren con caracteres raros como "frA!gil" en vez de "frágil", codifiquen el archivo .htm o .php en UTF8 (pueden usar, como les dije, Notepad++), esto no es necesario hacerlo con los archivos de CI, sólo con los que uds generen.

Espero haber sido de ayuda.




Theme © iAndrew 2016 - Forum software by © MyBB