PDA

View Full Version : How to avoid unwanted character while stored in DB



anbu.gn
20 Jan 2011, 5:14 AM
Hi,
To send a mail content i'm using ExtJS-html editor. I try to store the content to database. but its stored with garbage values (like ?) . How to avoid the garbage vaule?????

Example:

Original content: Above every month or a quarter there will be a comparison with the previous years month.

DB content : Above every month or a quarter there will be a comparison with the previous year?s month.

20 Jan 2011, 5:20 AM
are you HTML encoding your content?

valititi
20 Jan 2011, 5:45 AM
and AFTER encoding content (like Jay told before) have you tried tosomehow "work" a little on your content, on the server side BEFORE inserting into database ?
With some function that escape quotes, and/or escape special chars ? for php, for example, try to see arround string functions :
http://www.php.net/manual/en/ref.strings.php
htmlspecialchars, htmlentities, etc...

anbu.gn
9 Feb 2011, 4:08 AM
i did it based on your suggestions. But it showing same error.. Please Help me on that.

valititi
9 Feb 2011, 4:14 AM
sorry, i don't know more than this :-( :-)
for sure you must try between these string functions. Some encoding, deconding, your db encoding in the db engine, etc. The solution must be 100% somewhere there. Don't ask me which one... :-) One of them for sure ! Good Luck !

lukefowell89
9 Feb 2011, 4:33 AM
I had the same problem, all I did was replaced special characters with there html equivelent. This is by any means the best approach. I think I used a replace() function.

valititi
9 Feb 2011, 4:37 AM
with MANUALLY replace of some codes, you will have only a LIMITED number of replaces. Try to use a generic one, for having ALL the replaces... i think...