Wednesday, 15 April 2015

validation - Cleanup PHP String from Web Form Input -


I have a web-form that receives customer information form is processed using PHP 5.1.6 So that using filter_input () will not work.

This form has a text field with some other standard fields. I am getting a lot of strange formatting codes that are being stored in our MySQL database. How can I filter these results where they String formatting?

Before this

Where is the child's room? I think it's on the north side of the house Do you know where it is?

Later (this is what I have to see)
Where is the child's room? I think it's on the north side of the house Do you know where it is?

This is almost certainly cut-and-paste from someone due to the incompatible character set.

Looks like they're doing it with Microsoft Word, which uses non-ASCII unicode symbols for quotation and speech mark instead of the usual friendly ASCII. UTF-8 encodes as a series of two or more bytes from 80-FF, but often web pages are set to "Latin-1" which considers those bytes as separate letters, usually A -Jade with Accent If you see 2 or 3 characters, where you expect, and there are strange Latin symbols with some accents, then almost is always your data UTF-8, but it's in Latin Presented by some -1

An exception occurs when it was typed in UTF-8 and first place required as Latin-1, make sure your HTML form is clearly a character

In general, I do not advise you to use your web-based tool "UTF-8", without any good reason

Update: This is a little bit icky, but I recommend that you do not worry too much about database charsets. In fact, we should just miss UTF-8, but if you put UTF-8 data in the Latin-1 table, then whatever comes back will still be UTF-8, unless someone asks the database What is he sending you what I am saying is that due to the problem with MySQL, it is not possible that it is your code to read with cut-and-paste, browser, web form, form and writes to DB, Or is it possible, your Try reading the DB and render the HTML

iffy test page character encoding of characters. Try to install it on UTF-8 or to force UTF-8 in the browser. See Firefox-> Character Encoding in Firefox


No comments:

Post a Comment