preg_replace a specific character accent

I know the code works as per the demo below (the array is an array of $_POST[])
if I use the uncommented one it repace the "a" with é then correct values are inserted in DB and echoed as supposed to (utf8)
but when I try with the accentuated letter it does not find that accentuated letter, why would preg_match not find an accent?
what's going on?
$txt_fields	= Array ('fav_snack', 'fav_appetizer', 'fav_soup', 'fav_salad', 'fav_sandwich', 'fav_seafood', 'fav_pasta', 
										'fav_accompaniment', 'fav_veg_entree', 'fav_meat_entree', 'fav_dessert');
	foreach ($txt_fields as $fld) {//echo $fld;
	//	if (isset($_POST[$fld])) { $_POST[$fld] = preg_replace('/[é]+/i','é',$_POST[$fld]); echo $_POST[$fld];}
		if (isset($_POST[$fld])) { $_POST[$fld] = preg_replace('/[a]+/i','é',$_POST[$fld]); echo $_POST[$fld];}

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shinesh PremrajanEngineering ManagerCommented:
The code seems working fine, while echoing you can check using the function htmlentities($fld) instead of just $fld.

Hope this helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
array007Author Commented:
Well I found it
in the preg [é] is not correct it works if it is as follow: [\é]
Ray PaseurCommented:
I think you may have an encoding issue here.  The accented characters in the Western languages are often confused with the control characters that form a part of UTF-8.  You might want to have a look at this article and decide whether you really need UTF-8 or not.
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

array007Author Commented:
Thanks Ray, very good reading, even after eight years!
Ray PaseurCommented:
Yeah, Joel gets it right almost all the time!
Shinesh PremrajanEngineering ManagerCommented:
Yes thanks Ray, for the superb piece of information, its really worth a reading... kul..dude..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.