Welcome Guest, Not a member yet? Register   Sign In
Problems with accents and special characters
#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.


Messages In This Thread
Problems with accents and special characters - by El Forum - 07-10-2008, 02:47 PM
Problems with accents and special characters - by El Forum - 07-10-2008, 04:12 PM
Problems with accents and special characters - by El Forum - 07-10-2008, 05:01 PM
Problems with accents and special characters - by El Forum - 07-10-2008, 05:24 PM
Problems with accents and special characters - by El Forum - 07-10-2008, 05:36 PM
Problems with accents and special characters - by El Forum - 07-10-2008, 05:45 PM
Problems with accents and special characters - by El Forum - 07-10-2008, 06:02 PM
Problems with accents and special characters - by El Forum - 07-10-2008, 06:59 PM
Problems with accents and special characters - by El Forum - 07-10-2008, 08:40 PM
Problems with accents and special characters - by El Forum - 07-10-2008, 08:50 PM
Problems with accents and special characters - by El Forum - 07-10-2008, 09:49 PM
Problems with accents and special characters - by El Forum - 07-11-2008, 07:22 AM
Problems with accents and special characters - by El Forum - 07-11-2008, 08:08 AM
Problems with accents and special characters - by El Forum - 10-13-2008, 09:52 PM
Problems with accents and special characters - by El Forum - 11-01-2008, 07:10 PM
Problems with accents and special characters - by El Forum - 12-08-2008, 03:34 PM
Problems with accents and special characters - by El Forum - 12-08-2008, 04:08 PM
Problems with accents and special characters - by El Forum - 01-25-2009, 05:22 PM
Problems with accents and special characters - by El Forum - 01-25-2009, 05:40 PM
Problems with accents and special characters - by El Forum - 01-25-2009, 10:44 PM
Problems with accents and special characters - by El Forum - 01-26-2009, 12:07 AM
Problems with accents and special characters - by El Forum - 01-26-2009, 12:17 AM
Problems with accents and special characters - by El Forum - 07-03-2009, 05:11 PM
Problems with accents and special characters - by El Forum - 07-03-2009, 06:05 PM
Problems with accents and special characters - by El Forum - 07-04-2009, 04:33 AM
Problems with accents and special characters - by El Forum - 07-04-2009, 04:37 PM
Problems with accents and special characters - by El Forum - 11-28-2010, 07:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB