PDA

View Full Version : [Solved] Encoding with ExtJS 4 Proxy



Thiouzz
31 Oct 2012, 3:05 AM
I have encoding problem with Extjs Proxy i get ru00e9 instead of é for exemple, I tryed to add headers to the ajax call but it dosent help, all the other pages are ok the problem is just with the ajax calls, so how can I fix this, any Idea, thx.


var store = Ext.create('Ext.data.Store', {
model: 'Writer.History',
autoLoad: true,
autoSync: true,
proxy: {
type: 'ajax',
api: {
read: '/backend/pipeline/history.getlist',
create: '/backend/pipeline/history.add',
update: '/backend/pipeline/history.edit',
destroy: '/backend/pipeline/history.delete'
},
headers: { 'Content-Type': 'application/json; charset=utf-8; Cache-Control: no-cache' },
reader: {
type: 'json',
successProperty: 'success',
root: 'data',
messageProperty: 'message'
},
writer: {
type: 'json',
writeAllFields: false,
root: 'data'
},
listeners: {
exception: function(proxy, response, operation){
Ext.MessageBox.show({
title: 'REMOTE EXCEPTION',
msg: operation.getError(),
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
}
},
listeners: {
write: function(proxy, operation){
if (operation.action == 'destroy') {
store.load();
}
if(operation.action == 'create') {
store.load();
}
if(operation.action == 'update') {
store.load();
}
Ext.example.msg(operation.action, operation.resultSet.message);
}
}
});

James Goddard
31 Oct 2012, 3:47 AM
So you are getting the wrong chars on the server end when you send data? What is the charset in the HTML page itself? Are you seeing the converted chars in the network tab of the browsers debugger or juston the server side?

Thiouzz
31 Oct 2012, 4:55 AM
Problem Solved .. Was a server side problem,

Thx.