On Thu, October 5, 2006 5:14 pm, php@xxxxxxxxxxxx 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. I don't think MS Word quotes are Unicode, really... I think they're just made-up character sets that Microsoft felt like using to be incompatible with everybody else... There are about 5 different translations functions at http://php.net/str_replace, last time I checked -- but those assumed the user was just typing stuff in a FORM, and does not include your JS escaping... I *hope* it's the same thing, really, but can't promise. You're going to have to investigate what the JS escape mechanism is doing -- It could be any of a variety of things. Though the %u#### is almost-for-sure and ATTEMPT to apply Unicode conversion, that doesn't mean that the original content was really Unicode to start with. So after you "undo" the Unicode conversion, you've still potentially got data on your hands from a proprietary non-standards-based made-up software application. Apologies in advance if MS Word actually *is* using a standard Unicode charset... But I sure doubt it. > 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? -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php