Forum Moderators: open

Message Too Old, No Replies

Deleting MS Word 'fancy' characters from xml feed

ms word characters are destroying my feeds

         

zulubanshee

6:34 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



People are writing their info in MS Word and copy and pasting it into the textarea field and uploading to the database. I process feeds from this data. Problem is fancy quotes, ellipses, hyphens and a few other things are breaking the feeds.

Im using PHP. Is there a regular expression that will test for all these characters? I don't need to translate them. Im satisfied with deleting them.

httpwebwitch

7:02 pm on Jan 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



use htmlentities($string) [ca3.php.net]

zulubanshee

8:54 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



thanks ill give it a try.

zulubanshee

9:22 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



that doesnt seem to have worked :(

httpwebwitch

9:26 pm on Jan 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So... you're escaping the CDATA contents of your nodes with htmlentities(), and your XML is still invalid?

Can you supply a *small* sample, before and after

zulubanshee

9:33 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



You had it right! I had to change the character set from UTF-8 to 8859.

britlinks created a great function here

[us3.php.net...]

Thanks for your help dude!

httpwebwitch

9:49 pm on Jan 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hey no problem zulubanshee. cheers

vincevincevince

3:40 am on Jan 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Real problem is that browsers are POST-ing those characters even when a form is served UTF-8. If a form is served UTF-8 then the browser should only be allowing UTF-8 content within it.