Welcome Guest, Not a member yet? Register   Sign In
Encoding characters problem
#1

[eluser]nuts[/eluser]
Hi !

I post this message because I have a problem with special characters on my webpage :\

I've configured my charset like this :
(in my pages)
Code:
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />

In my config.php
Code:
$config['charset'] = "UTF-8";

In my database.php
Code:
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";



I read lots of topic about the problem, but don't manage to fix it :\
Usually I use an iso charset, but I didn't managed to make it work as I wanted, so I decided to use the UTF-8 charset. Not only I have to wrote all my spcial characters with their code like "à" to make it appear correctly on the static part of my pages .. but also, when I "edit" a message posted on my website, ... a message like "éàèç" become "éà çè" ...

I don't understand :\ the first time the message is resigtered in the database he is correctly registered, and next time, all my special characters are transformed :\
Moreover, the first post and the edition are made on the same webpage (I make appear a div to edit the message I want) so the charset is the same :\

Please help me I really don't understand this problem :\
Thanks


p.s. sorry for my english (I think I gonna write this sentence in my signature instead of making a p.s. every time I post :p)


EDIT : I've also tried to change the Interclassment of my text fields in my database (I tried latin1_swedish_ci, utf8_general_ci, ...)
#2

[eluser]Bramme[/eluser]
htmlentities($_POST['message'])

have you tried that?
#3

[eluser]nuts[/eluser]
yes it's on my validation rules Smile
#4

[eluser]marcoss[/eluser]
Your files (the PHP ones) must be UTF-8 encoded as well, make sure your IDE/Editor is correctly set up and have support for UTF-8.
#5

[eluser]nuts[/eluser]
I think it just concern my static pages.
My main problem (and I need to solve it in contrary to the problem with my IDE) is, when I post a message .. he's well registered in my databse, but when I edit it (on the same page) it transforms all my special characters ... so I don't understand what is the difference between my post and my edition ... I make an htmlentities on both actions .. Confused
#6

[eluser]nuts[/eluser]
Finally I've abandoned UTF-8 and I've changed my configuration like that (if it can help someone in the future Smile)

In my pages
Code:
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />

In my config.php
Code:
$config['charset'] = "ISO-8859-1";

In my database.php
Code:
$db['default']['char_set'] = "latin1";
$db['default']['dbcollat'] = "latin1_swedish_ci";

Now in phpmyadmin in configured my database like that :
Code:
MySQL connection collation: latin1_swedish_ci

Now it works ... hope it will be helpful in the future Smile
#7

[eluser]CI flea[/eluser]
I have encountered the same problem, and tried all suggestions (database, text editor etc) with no luck.

However if I do not use the the database class, but just connect using mysql_connect('server', 'user', 'password') using CI 1.6.3, I have no problems with UTF-8 encoding. So it would seem that it is being caused by the database class?

I am converting an existing site (which has everything set up to use UFT-8 without any problems, and would like to keep this encoding.
#8

[eluser]vickel[/eluser]
thank you for your own post on Posted: 13 July 2008 04:08 PM

it helped a lot, Im writing in portuguese and using "ç ã õ á à â" chars, i looked in the CI userguide, but no hints, then I found your reply in CI_Forum when searching for "utf8_general_ci"




Theme © iAndrew 2016 - Forum software by © MyBB