Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi! Can somebody tell me or poin

Status
Not open for further replies.

TomasDill

IS-IT--Management
Sep 2, 2000
703
UA
Hi!

Can somebody tell me or point in right direction how I can change the page character set on the fly? Any hints, tips etc.

I did used following lines:

if (strLang=="Russian")
document.charset = "windows-1251"
else
document.charset = "windows-1252";

Well, for the first time I was glad it does something after I looked to the menu "View->Encoding". However, after some playing, I did figured out that this just affects menu and nothing else! Just selected "Western Europen" character set in menu, and command document.charset = "windows-1251" switch option in menu, but page content does not change. Note that reloading a page is not a good option and it seems does not work too. (I'm using a set of DIV chapters that I show and hide - they contain content with different languages.)

;-(

Vlad Grynchyshyn, MVP
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
i'm not sure that this can be done client side
the encoding is usually specified in the headers - meaning, there are set on the server side
 
Ok, even with reloading page, how can I change the encoding on the fly? I know there is a "META" tag for this, but I cannot find a list of all character encoding values. In addition, will it render page correctly even in case browser's menu used to eplicitly tell what character encoding should be used? Vlad Grynchyshyn, MVP
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
ok, i'm reading : and on character sets they say This use of the term "character set" is more commonly referred to as a "character encoding." [...] HTTP character sets are identified by case-insensitive tokens. The complete set of tokens is defined by the IANA Character Set registry [19] [..] Although HTTP allows an arbitrary token to be used as a charset value, any token that has a predefined value within the IANA Character Set registry [19] MUST represent the character set defined by that registry. Applications SHOULD limit their use of character sets to those defined by the IANA registry. Implementors should be aware of IETF character set requirements [38] [41].[...]Some HTTP/1.0 software has interpreted a Content-Type header without charset parameter incorrectly to mean "recipient should guess." Senders wishing to defeat this behavior MAY include a charset parameter even when the charset is ISO-8859-1 and SHOULD do so when it is known that it will not confuse the recipient. Unfortunately, some older HTTP/1.0 clients did not deal properly with an explicit charset parameter. HTTP/1.1 recipients MUST respect the charset label provided by the sender; and those user agents that have a provision to "guess" a charset MUST use the charset from the content-type field if they support that charset, rather than the recipient's preference, when initially displaying a document. See section 3.7.1. 371 says : The "charset" parameter is used with some media types to define the character set (section 3.4) of the data. When no explicit charset parameter is provided by the sender, media subtypes of the "text" type are defined to have a default charset value of "ISO-8859-1" when received via HTTP. Data in character sets other than "ISO-8859-1" or its subsets MUST be labeled with an appropriate charset value. See section 3.4.1 for compatibility problems (ok 341 is where we come from)
and [19] [38] and [41] are :
[19] Reynolds, J. and J. Postel, "Assigned Numbers", STD 2, RFC 1700, October 1994.
[38] Yergeau, F., "UTF-8, a transformation format of Unicode and ISO-10646", RFC 2279, January 1998.
[41] Alvestrand, H., "IETF Policy on Character Sets and Languages", BCP 18, RFC 2277, January 1998.

the interesting part is that content type seems to override user settings - in some case

maybe this can help as well, but it's ms only
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top