Saturday, August 1, 2009

De-sanitize for Text Boxes

Hi,

I'm new to CakePHP and I came across a little problem.

I created a scaffold to upload a list of schools to my database and
after uploading about 400, I noticed that some of the schools were
disappearing both from the scaffold view and the database. Since no
one else has access to my system, I realized that the only possible
reason for that is that some characters I entered, like apostrophes
('), hyphens (-), and commas (,), caused trouble in the database
somehow.

I created a new scaffold using Bake and decided use Sanitize::clean()
before saving. So far, schools are no longer disappearing, but when I
try to edit one of these, the characters are NOT displayed correctly
in the text boxes (e.g: O'Malley). I tried using the PHP method
htmlspecialchars_decode() (http://us.php.net/htmlspecialchars_decode)
before sending $this->data to the view but it didn't work, characters
are still showing up like that.

I was wondering if someone could help me to solve this problem. I
don't know if I'm doing something wrong, cuz I'm very surprised that
Cake has problems handling special characters, since a lot of last
names use apostrophes. If you think I should use a different approach,
please let me know as well.

Thanks in advance.
Ponch316

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: