PDA

View Full Version : Foreign Language Problems



oracio
27 May 2007, 8:09 AM
Hello,

I have this problem: I set a grid that gets its data from a json file.
some of the vars there are in hebrew.
I can see in the FireBug that it gets question marks where the hebrew chars were.
and of course i get the same result in my grid.

how do i solve this?

Animal
27 May 2007, 8:27 AM
What character encoding scheme does your server use to convert its Characters into a byte stream to send down the wire?

Whatever scheme it uses, you have to tel the browser that in your Content-Type header:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17

http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.4

http://www.w3.org/International/getting-started/characters

oracio
27 May 2007, 8:36 AM
Hi,

I have a content type in the Grid html (<meta http-equiv="Content-Type" content="text/html; charset=windows-1255" />)

but the problem is in the file that generates the json list.
i can't put there the meta line because it isnt a html file it is just a generated json list.
can i put the Content-Type inside the javascript and not as a meta?

liggett78
27 May 2007, 8:42 AM
Your server should return an HTTP Header named Content-Type with proper values.

Animal
27 May 2007, 8:43 AM
You're using remote paging, and sending Json from the server?

You'll have to set the "charset" property on the Content-Type HTTP Header.

oracio
27 May 2007, 9:00 AM
Thank you very much. :D
solved it with


Response.ContentType = "text/html; charset=windows-1255"

oracio
28 May 2007, 7:50 AM
I have another problem regarding content type,
this time i'm trying to send a POST from a basicform which has hebrew chars.
how do i do something like XMLHttp.setRequestHeader('text/html; charset=windows-1255')
inside Ext?

Animal
28 May 2007, 8:01 AM
If you are using YUI as the underlying library (and it is the most robust and well designed), then you should be able to use the methods of YAHOO.util.Connect to set headers.

Docs are only at YAHOO, and their generator is not nearly as good as Ext's, but: http://developer.yahoo.com/yui/docs/YAHOO.util.Connect.html

try initHeader()

YMMV, I haven't tried this yet.

oracio
28 May 2007, 8:10 AM
so I need to work with another library to change the charset?

my post looks like this:



gridForm.submit(
{
waitMsg: 'Saving changes, please wait...',
url:'true.asp',
params:{data:jsonData},
success:function(form, action) {
alert('Congrats! Your changes were saved!!!!');
},
failure: function(form, action) {
alert('Oops the delete did not work out too well!');
}

}
);


in the jsonData there are hebrew chars that need to be sent to the server to update the database
isnt there an easier way to set the charset?

Animal
28 May 2007, 8:15 AM
Ext sits on top of foundation libraries which provide cross-browser access to DOM, event, animation and Ajax utility classes.

You choose which of them to use when you include adapters.

So. If you are using the YUI adapter, then you can use YAHOO.util.Connect methods to set headers.

Currently, the Ext.form.Action class does not offer a way to set headers.

I think it's arguable that it should offer this for precisely the reasons that you are giving now. So I'd suggest posting a feature request.

But for now, a reasonable easy workaround would be to use YAHOO.util.Connect.initHeader()

oracio
28 May 2007, 9:04 AM
I put this line:


YAHOO.util.Connect.initHeader("Content-Type", "text/html; charset=windows-1255");

before my code



gridForm.submit(
{
waitMsg: 'Saving changes, please wait...',
url:'true.asp',
params:{data:jsonData},
success:function(form, action) {
alert('Congrats! Your changes were saved!!!!');
},
failure: function(form, action) {
alert('Oops the delete did not work out too well!');
}

}
);


and now my post looks like this:

&data=%5B%7B%22itemid%22%3A3%2C%22itemname%22%3A%22%D7%A1%D7%95%D7%93%20%D7%94%D7%A4%D7%A9%D7%95%D7%98

%D7%9B%D7%9B%22%2C%22itempath%22%3A%22books%2Fb-simple.gif%22%2C%22itemprice%22%3A80%2C%22itemwidth%22

%3A148%2C%22itemheight%22%3A220%7D%5D

hmm i'm clueless

oracio
28 May 2007, 10:02 AM
I had to change my code from gridForm.submit to gridForm.load to make it post hebrew.
i have no idea why it worked but it did ;)

the code before:


gridForm.submit(
{
waitMsg: 'Saving changes, please wait...',
url:'true.asp',
params:{data:jsonData},
success:function(form, action) {
alert('Congrats! Your changes were saved!!!!');
},
failure: function(form, action) {
alert('Oops the delete did not work out too well!');
}

}
);


the code now:


gridForm.load(
{
url: "http://www.....co.il/ajax/true.asp",
params: "data=" + jsonData,
text: "Updating..."
});


the thing is that previously with the .send option I had a success and failure params, and I dont have those in .load, is there a way to achive the same result so I could get a respond from the server if it succeed and translate it into an action?

Animal
29 May 2007, 12:12 AM
Are you uploading a file?

shlomisderot
20 Mar 2008, 4:57 AM
I'm trying to put hebrew characters in the tab title but its show mas in the front, how I can use jsExt components with hebrew langauge?

Here the code that I'm trying to use:



var tabs2 = new Ext.TabPanel({
renderTo: document.body,
activeTab: 0,
width:600,
height:250,
plain:true,
defaults:{autoScroll: true},
items:[{
title: "דף הבית',
html: "My content was added during construction."
},{
title: 'אני',
autoLoad:'ajax1.htm'
},{
title: 'Ajax Tab 2',
autoLoad: {url: 'ajax2.htm', params: 'foo=bar&wtf=1'}
},{
title: 'Event Tab',
listeners: {activate: handleActivate},
html: "I am tab 4's content. I also have an event listener attached."
},{
title: 'Disabled Tab',
disabled:true,
html: "Can't see me cause I'm disabled"
}
]
});



Thank you,

mystix
23 Mar 2008, 10:28 PM
I'm trying to put hebrew characters in the tab title but its show mas in the front, how I can use jsExt components with hebrew langauge?

Here the code that I'm trying to use:


i've replied in to your identical post in 1.x Bugs:
http://extjs.com/forum/showthread.php?p=141023#post141023

pls refrain from double posting in future.