tags:

views:

318

answers:

1

can i change the char-set of the page in jquery ?

i need it , because i support old system that not use utf-8.

on user click i want to show different language form .

It is text that come via ajax

I CAN GET IT BUT COULD NOT CHANGE IT :

var meta = $("meta").attr("content");
alert(meta);

thanks

+1  A: 

Nope, the charset is fixed for a document. However, you can dynamically (with JavaScript, that is) insert any Unicode character like this:

document.write ('\u2200 browsers.'); // gives '∀ browsers'

The different language on user click: Is the text inserted via JavaScript (perhaps via AJAX), or is it another HTML page to be embedded somehow?

Cheers,

Update: It seems (I haven't tested it), that in IE you can actually set the charset via document.defaultCharset, although possibly this has only an effect, if there is no charset delivered with the HTML file. In Gecko based browsers (like Firefox) you can get the charset via document.characterSet.

Boldewyn
It is text that come via ajax
Haim Evgi