the reason why I change the charset is that the current php page requires 'uft-8' to show Chinese & english correctly, but the component to login requires 'gbk'. after login, it comes back to the current php page again which requires 'utf-8'.
this js code just doesnt work in firefox.
anyone any idea how to change the charset in firefox ?
IE has scriptable document.charset property which is officially read/ write.
Gecko-based browsers do have read-only document.characterSet property. It returns the currently effective encoding, that may differ from the specified by server/META (if overridden by View - Charachter Encoding). From MDC: "The related, nonstandard method document.charset and the property document.defaultCharset are not supported by Gecko.
As Rajsedhain said, the document.charset used to obtain the document's character encoding and can be rewritten , change the font charset will also affect the page in IE, Now the Webkit engine browser has support this property , the FF is still not supported
,although there is a document,characterSet property , which is read-only, And as a result , when you rewrite the property in the FF, it seems pointless
Hi, in my opinion, 'utf-8' works where 'gbk' works, does it?
Because in that component, the DB part, data is saved in gbk in that table. when the login works perfectly if username is english, if the user name is Chinese, it doesnt work. that's why i converted to gbk and submit the form then converted it back to utf-8.
which not work in FF....
hi, thanks for the reply, seems hopeless to try to reset the characterset of FF, maybe should be some other way around to solve the issue.
basically the problem is, there is a component we used in the php project, the data is saved in gbk in the table, when login with chinese username it wont match, so have to submit the form with gbk converted data.. then convert it back to utf-8 after submit
the form....
Tanya Li
Member
27 Points
15 Posts
document.charset="gbk" not working in firefox
Feb 22, 2012 06:25 PM|LINK
I have this piece of code which works perfectly in IE & Chrome, but not in firefox.
document.charset="gbk";
document.getElementById("form_login").submit();
document.charset="utf-8";
and in the header i have:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
the reason why I change the charset is that the current php page requires 'uft-8' to show Chinese & english correctly, but the component to login requires 'gbk'. after login, it comes back to the current php page again which requires 'utf-8'.
this js code just doesnt work in firefox.
anyone any idea how to change the charset in firefox ?
thanks a lot !
Tanya
rajsedhain
Contributor
4181 Points
1041 Posts
Re: document.charset="gbk" not working in firefox
Feb 22, 2012 07:10 PM|LINK
IE has scriptable document.charset property which is officially read/
write.
Gecko-based browsers do have read-only document.characterSet property.
It returns the currently effective encoding, that may differ from the
specified by server/META (if overridden by View - Charachter
Encoding). From MDC: "The related, nonstandard method document.charset
and the property document.defaultCharset are not supported by Gecko.
see here:
http://objectmix.com/javascript/301915-setting-dynamically-greek-charset-firefox.html
Raj Sedhain
FightAsABull
Contributor
2228 Points
424 Posts
Re: document.charset="gbk" not working in firefox
Feb 28, 2012 04:20 AM|LINK
Hi, in my opinion, 'utf-8' works where 'gbk' works, does it?
Danny Gokey
Member
290 Points
56 Posts
Re: document.charset="gbk" not working in firefox
Feb 28, 2012 05:51 AM|LINK
Hi,
As Rajsedhain said, the document.charset used to obtain the document's character encoding and can be rewritten , change the font charset will also affect the page in IE, Now the Webkit engine browser has support this property , the FF is still not supported ,although there is a document,characterSet property , which is read-only, And as a result , when you rewrite the property in the FF, it seems pointless
Tanya Li
Member
27 Points
15 Posts
Re: document.charset="gbk" not working in firefox
Mar 05, 2012 06:19 PM|LINK
Because in that component, the DB part, data is saved in gbk in that table. when the login works perfectly if username is english, if the user name is Chinese, it doesnt work. that's why i converted to gbk and submit the form then converted it back to utf-8. which not work in FF....
Tanya Li
Member
27 Points
15 Posts
Re: document.charset="gbk" not working in firefox
Mar 05, 2012 06:20 PM|LINK
so basically you meant there is no solution to this kind of issue ?
well the problem is, the php page is utf-8, data saved in the table is gbk. so have to convert the data before submit the form.
Tanya Li
Member
27 Points
15 Posts
Re: document.charset="gbk" not working in firefox
Mar 05, 2012 06:23 PM|LINK
hi, thanks for the reply, seems hopeless to try to reset the characterset of FF, maybe should be some other way around to solve the issue.
basically the problem is, there is a component we used in the php project, the data is saved in gbk in the table, when login with chinese username it wont match, so have to submit the form with gbk converted data.. then convert it back to utf-8 after submit the form....