Part of the EllisLab Network
   
2 of 2
2
Problems with accents and special characters
Posted: 08 December 2008 05:08 PM   [ Ignore ]   [ # 16 ]  
Lab Assistant
RankRank
Total Posts:  229
Joined  06-04-2007

Hola, estoy fue lo que yo hice (en mis vistas y en la base de datos)

Entonces las unicas cosas que tuve que hacer:

En la base de datos:

      DB Collation: utf8_general_ci

en la vista:

<html lang=“es”>

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

Saludos

 Signature 

http://www.asinox.net
CodeIgniter code and more.

Profile
 
 
Posted: 25 January 2009 06:22 PM   [ Ignore ]   [ # 17 ]  
Summer Student
Total Posts:  4
Joined  01-25-2009

Hello guys! just for the record, I’m working with Spanish especial chars, and this is what I did to get it rollin. Change the values in the database.php inside your config folder like these:

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

Then just make sure that the collation of your attributes in your db are “latin1_swedish_ci”.

And that is all!

Hope this helps someone!
Cheers! :D

Profile
 
 
Posted: 25 January 2009 06:40 PM   [ Ignore ]   [ # 18 ]  
Lab Assistant
RankRank
Total Posts:  229
Joined  06-04-2007
Andres Ledesma - 25 January 2009 06:22 PM

Hello guys! just for the record, I’m working with Spanish especial chars, and this is what I did to get it rollin. Change the values in the database.php inside your config folder like these:

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

Then just make sure that the collation of your attributes in your db are “latin1_swedish_ci”.

And that is all!

Hope this helps someone!
Cheers! :D

Im sorry Andres but the real thing is:

$db[‘default’][‘char_set’] = “utf8”;
$db[‘default’][‘dbcollat’] = “utf8_general_ci”;

All chars wink

 Signature 

http://www.asinox.net
CodeIgniter code and more.

Profile
 
 
Posted: 25 January 2009 11:44 PM   [ Ignore ]   [ # 19 ]  
Summer Student
Total Posts:  4
Joined  01-25-2009

Well, I used “latin1” as char_set and “latin1_swedish_ci” as coll, and the accents and “ñ” worked like a charm.
smile

Profile
 
 
Posted: 26 January 2009 01:07 AM   [ Ignore ]   [ # 20 ]  
Lab Assistant
RankRank
Total Posts:  229
Joined  06-04-2007

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

 Signature 

http://www.asinox.net
CodeIgniter code and more.

Profile
 
 
Posted: 26 January 2009 01:17 AM   [ Ignore ]   [ # 21 ]  
Summer Student
Total Posts:  4
Joined  01-25-2009

Excellent! Thanks for the tip, its always good to share knowledge!

Cheers! grin

Profile
 
 
Posted: 03 July 2009 06:11 PM   [ Ignore ]   [ # 22 ]  
Summer Student
Avatar
Total Posts:  8
Joined  06-18-2009

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!!

 Signature 

Gerardo Jaramillo
Web Aficionado

Profile
 
 
Posted: 03 July 2009 07:05 PM   [ Ignore ]   [ # 23 ]  
Summer Student
Total Posts:  4
Joined  01-25-2009

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!

Profile
 
 
Posted: 04 July 2009 05:33 AM   [ Ignore ]   [ # 24 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  3782
Joined  04-25-2008

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:

header('Content-type: text/html; charset=utf-8');
 Signature 

Remember the 8 Ps: Perfect Planning and Prior Preparation Prevents Piss-Poor Performance.


Not sure where to start with your project? Need some inspiration? Check out my CodeIgniter Resources thread

Profile
 
 
Posted: 04 July 2009 05:37 PM   [ Ignore ]   [ # 25 ]  
Summer Student
Avatar
Total Posts:  8
Joined  06-18-2009

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

 Signature 

Gerardo Jaramillo
Web Aficionado

Profile
 
 
   
2 of 2
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120315 Total Logged-in Users: 56
Total Topics: 126434 Total Anonymous Users: 5
Total Replies: 664882 Total Guests: 466
Total Posts: 791316    
Members ( View Memberlist )