Link to home
Start Free TrialLog in
Avatar of vrosas_03
vrosas_03

asked on

PHP MySQL query spaces become: T T T T T

I'm using Ajax to query the database and display the text on a page.   If the text in the database has spaces for example:

"text                                   text."

it becomes:

"textТ Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т Т text"

If I then submit that it becomes this:

textаЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ аЂТ  text

I can't find anything online that explains this behavior.  

Even if I do a string replace in Javascript I can't get rid of it.   I can change the t in text or the e or the word text.  But If I try to replace the /T /  nothing will happen.  

I think it may be some kind of Unicode character
Avatar of ozo
ozo
Flag of United States of America image

Can you post the code that does the query and display?
There are no unicode characters in your firt or second string.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vrosas_03
vrosas_03

ASKER

I'm working with an editable div and sending the data using jQuery.ajax.   It was confusing because the problem appears to have happened in two separate ways.  First I would see the T's in firebug in the ajax post variable.  It would appear as &\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 as the response.    The spaces would appear in the phpmyadmin as just spaces with no problems.   But when I would call it from the database it would appear as T's   After getting it from the database I used the preg_replace ord command to isolate the character which turned out to be 194  which in the extended ascii character set is used to create boxes and it's shaped like a T so I guess it's to create adjoining boxes.   I used this expression to get rid of it:
$event->body = preg_replace('/\xC2/', "", $event->body)
The spaces were still there.  For some reason it's like there is a regular expression going on behind the scenes adding adding an extra character.     It seems like a character set problem.