Re: Unicode Problem

From: Date: Fri, 06 Oct 2006 02:40:52 +0000
Subject: Re: Unicode Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-242742@lists.php.net to get a copy of this message
On Thu, 05 Oct 2006 18:14:59 -0400, php@swimwebs.com wrote: > I have a webpage that allows users to post news stories for their department. The site uses > AJAX to send the data to the webserver. The problem I'm having is when the user uses some > unicode characters like bullets or MS Word quotes, the page comes out weird. > > Here's the process. > 1. The user enters the story and clicks save. > 2. The javascript uses the escape function to turn the text into something that can be posted > to the server. This function turns spaces into %20, but it turns unicode characters into a longer > string like %uXXXX. > 3. The javascript then sends the data to the processing page. > 4. The PHP processing page receives the data and saves it to the mySQL database server. > > The problem I see is that any unicode character is saved in it's escaped unicode sequence. > For example a bullet is saved into the database as a literal %u2022. What I need to know is what > function can I use so that it's either saved as the unicode bullet character or displayed back > on the page as the bullet? > > Thank you > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php If you post that data via POST method, use encodeURIComponent() to encode the string, and then the server-side script can accesses it directly. -- Sorry for my poor English.

« previous php.general (#242742) next »