This is a discussion on PHP string infected with weird characters. within the Coding Help forums, part of the Webmaster Help category; Since building a simple blog tool a few weeks ago I have been wrestling with some mysterious characters that infect ...
| |||||||
| Register | Forum Rules | FAQ | Donate | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Since building a simple blog tool a few weeks ago I have been wrestling with some mysterious characters that infect in the users input. The user in questions is using a Windows system that for some reason enters characters like " or - in a none standard way. The result, blog entries with stuff like � Anybody have an idea why this is happening and more crucially how I can eradicate it! |
| |||||
| they're probably pasting from Word. Instead of producing a double-quote like ", Word has two different types for the left side and right side of a string. The "strange" hyphen (-) is probably an "em dash". If you use the UTF-8 character set, you should see this stuff solved. |
| |||||
| It seems somebody is trying to break your website or is purelly mistake. first you should try to convert the user input into html char() and then before insterting the data add some php functions to protect the database. PHP Code: PHP Code:
__________________ :. Web Design & Development Web Design Ireland :. Search Engines Optimization Search Engines Optimization :. Directory Submission Directory Submission :. News & Press Release Ireland GiveItSocks.com :. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories :. I Have 2 Find It Directory SEF Directory |
| ||||
| Apologise for not responding before, thank you for your advice. I have tried the various approaches suggested but have failed to resolve the issue satisfactorily. Due to other more pressing matters and the fact that the circumstances around the data entry can be completely controlled I have opted for a human solution. Put manners on the person who was pasting their entries from MS Word. I am sure with the aid of your suggestions I could resolve this technically but this year I am trying to learn how to avoid time holes. Those unexpected issues that become technical challenges that eat up all your time, yet must be resolved just so you can prove to yourself that you can... |
| |||||
| Quote:
__________________ My Blog |
| |||||
| if you are using it for textarea field, add FKeditor to it with minimum buttons and edit the javascript and where it says "force paste to plain text" change from false to true. That should help a lot. |