• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Charset ISO-8859-1


I begun yesterday with CodeIgniter, and now I got the first real problem (lucky me Tongue)
The thing is when I go to my website, I got problem with characters.
The charset I need to use to get this work is: Charset ISO-8859-1

Because åäö doesn't work(doesn't know if you can se wich characters) because it is letters in swedish...

How can I change my charset.
My files i encode as Charset ISO-8859-1, but that doesn't help, it doesn't work.

Thanks Smile

Hello, it might be helpful if you could post more information about the problem.

Are you seeing an error message or are the proper characters just not displaying? Basically, is this an input or output problem (from your post it seems like it might be output-related)?

yes the problem is the text that I output from the database with echo in PHP.

The characters Å Ä Ö displays very strange...

It is wrong charset, or they are mixed together, the charset.

I don't know, strange letters when I output from my Database not if I only use echo and write something

&lt;meta http-equiv = "Content-Type" content = "text/html; charset=ISO-8859-1"&gt;

In your html head and make sure your database and table are ISO-8859-1

These need to be the same charset. To mee it seems the table, browser or datase have a different charset then iSO-8859-1

Thanks for reply Smile

The documents is correct charset, and the database: latin1_swedish_c
This has been working everytime when I didn't used CodeIgniter, Can i configurate something in CodeIgniter?

try the config file:
$config['charset'] = "ISO-8859-1";

Maybe that will help.

i have already tried that without no success.

I also tried in database.php:

$db['default']['char_set'] = "latin1_swedish_ci";
$db['default']['dbcollat'] = "latin1_swedish_ci";

But no success:


There are some points you have to consider when choosing a charset, you might want to check out Phil's or my article on using UTF-8 with CodeIgniter.
I think everything we said about UTF-8 should be true for ISO-8859-1 aswell.

Try utf8_decode() around the database string and see if that works.
If so, there is still a problem with inserting and/or getting data from the database

Could you try adding the following meta element to your template?

&lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;

I'm able to reproduce and solve the problem this way (with static text "Åå, Ää, and Öö" displaying correctly in a template--no db required to test).

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.