PDA

View Full Version : encoding text with double quote



rafmak1
21 Apr 2016, 6:39 AM
Hi,
I have a grid which i encode it on json and save it in my database in one column( i can' t change it :( ) .the problem is when some inserted in some column of the grid a text with double quote.
when I retreive this row i can't display it.
I tried to change saving by escaping double quote but i can't
here some code :


var storeValue = [];
var allRecords = grid.store.getRange(0);

for (i = 0; i < allRecords.length; i++)
{
/* var s= allRecords[i].data.toString();
var s2=s.replace('"', '\"');
storeValue[i] = s2;*/
storeValue[i]=allRecords[i].data;


}

var gr = '';


if (grid.getStore().getCount() != 0)
{

gr = Ext.util.JSON.encode(storeValue);
}


Regards.
PS: the commented part is my attempt to resolve the problem

Gary Schlosberg
21 Apr 2016, 10:56 AM
So you're saving a bunch of JSON into a single database field? What database are we talking about?

rafmak1
21 Apr 2016, 11:58 PM
So you're saving a bunch of JSON into a single database field? What database are we talking about?

Yes , it's already implemented and i can't change it.
a Mysql database.