PDA

View Full Version : Using Ext.Encoding in Android return wrong character encoding



korka
13 Dec 2011, 8:45 AM
When i use Ext.encode(....) some Russian text i got it with wrong unicode, like - "\\u044f\\u0439\\u0446\\u0430\\u0430\.

Same from browser works fine.

mitchellsimoens
13 Dec 2011, 12:22 PM
Can I get a runnable test case?

korka
13 Dec 2011, 10:53 PM
Check attachment.
Unzip it, configure sencha touch path in index html (i created this test under sencha-touch-1.1.0\examples\ directory, so unzip to this directory should works).

The test is very simply. I do - Ext.encode("?????? ????!") and show result in message box. In Windows Chrome browser the text is shown ok. When i run it from browser in HTC Desire i got "\u0..." result.

P.S. ?????? ????! - Good Morning! :)



Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function(options) {

var panel = new Ext.Panel({
fullscreen: true,
layout: {
type: 'vbox',
align: 'center',
pack: 'center'
},
items: [{
xtype: 'button',
ui: 'normal',
text: 'Show Text',
handler: function() {

var msg = Ext.encode("?????? ????!");

Ext.Msg.show({
title: ""
,msg:Ext.util.Format.ellipsis(msg, 2000)
,icon:Ext.Msg.ERROR
,buttons:Ext.Msg.OK
,minWidth:1200 > String(msg).length ? 360 : 600
});
}
}]
});
}
});