Private Message System - Comments don't treat accents.

Ask about a PHP problem here.
Post Reply
bluebird
Posts: 8
Joined: Fri Mar 09, 2012 3:00 am

Private Message System - Comments don't treat accents.

Post by bluebird »

Hi,

I've followed the tutorial for the private message system. Everything works as expected, only that the system is meant for french users, so what users publish contains accents. So far, I've fixed it so if I manually insert content inside the database, the system will display the accents correctly. I am therefore assuming that the problem come from when content is inserted by the system into the tables inside the database. The accents are not recognized inside the darabase, even, which could explain why they aren't displayed when queried by the system.

I would greatly appreciate your help with this.
bluebird
Posts: 8
Joined: Fri Mar 09, 2012 3:00 am

Re: Private Message System - Comments don't treat accents.

Post by bluebird »

I fixed this problem by removing htmlentities() around my post variables.
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Private Message System - Comments don't treat accents.

Post by Temor »

htmlentities has a second parameter where you can set encoding.
htmlentities($string, ENT_COMPAT, 'UTF-8');
I think UTF-8 has support for accents. No promises though.
check out the php docs page for more in depth info
http://php.net/manual/en/function.htmlentities.php
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Private Message System - Comments don't treat accents.

Post by jacek »

Temor wrote:I think UTF-8 has support for accents.
Yup :D
Image
bluebird
Posts: 8
Joined: Fri Mar 09, 2012 3:00 am

Re: Private Message System - Comments don't treat accents.

Post by bluebird »

Thanks!
Post Reply