473,569 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing or at least detecting character encoding via javascript ?

Hi all,

I have a question if it is possible to manipulate the settings of
character encoding in Ms Internet Explorer 5.0, 5.5 and 6.0. The
problem is that the default instalation of Ms IE seems to have hard
selected default encoding to "Western European (ISO)", which means
iso-8859-1. When browsing pages with some Central/Eastern European
characters these are converted to iso-8859-1 so displayed wrong.

I would suppose the "auto-select" option should be default, so the
browser can select the right encoding according to the meta-tags in
the head of webpage. But this is apparently not true.

Please, is it possible to use JavaScript or Java applet to get the
information about the current client character encoding settings
and/or change it to the "auto-select" value ? How to do this ?

Thanks in advance,

David Komanek
Jul 20 '05 #1
10 17605


David Komanek wrote:
Hi all,

I have a question if it is possible to manipulate the settings of
character encoding in Ms Internet Explorer 5.0, 5.5 and 6.0. The
problem is that the default instalation of Ms IE seems to have hard
selected default encoding to "Western European (ISO)", which means
iso-8859-1. When browsing pages with some Central/Eastern European
characters these are converted to iso-8859-1 so displayed wrong.

I would suppose the "auto-select" option should be default, so the
browser can select the right encoding according to the meta-tags in
the head of webpage. But this is apparently not true.

Please, is it possible to use JavaScript or Java applet to get the
information about the current client character encoding settings
and/or change it to the "auto-select" value ? How to do this ?


What about using the HTML <meta> tag:
<meta http-equiv="Content-Type" content="text/html;
charset=yourCha rsetHere">

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Hello!

ko*****@natur.c uni.cz (David Komanek) wrote in message news:<e5******* *************** ****@posting.go ogle.com>...
Hi all,

I have a question if it is possible to manipulate the settings of
character encoding in Ms Internet Explorer 5.0, 5.5 and 6.0. The
problem is that the default instalation of Ms IE seems to have hard
selected default encoding to "Western European (ISO)", which means
iso-8859-1.
No, there is no such thing in Internet Explorer as
'default encoding' (Netscape/Mozilla do have such thing).
When browsing pages with some Central/Eastern European
characters these are converted to iso-8859-1 so displayed wrong.


Martin and VK has already answered that - it's a _site_'s problem,
it's probably does not specify its encoding so you need to choose
it manually in IE's menu - only if theb page you visited right
before was not Central European - then IE will show your new page
Ok - if a new page does not specify its encoding, IE uses
*last used encoding* to show such page.

--
Regards,
Paul Gorodyansky
"Russian On-screen Keyboard"
(based on the JavaScript code by Matin Honnen et al):
http://ourworld.compuserve.com/homep...r/onscreen.htm
Jul 20 '05 #3
Hi all,

thank you for the responses. Unfortunately my colleague is abroad, in
Netherlands and I have no possibility to play with his compoter (and all
computers in his department, too :-) But What I can tell for sure is
that I have the appropriate meta-tag in the page: iso-8859-2. He says he
has iso-8859-1 is his setting what he sees in the "view|encod ing" menu
as selected. And all the Czech characters he sees converted to the
english equivalents. For example &Aacute; he sees as a simple "A" if I
use the normal character. Only two ways to get the right character to
his display which I can go is to use the &Aacute; entity itself or to
recode the page to utf-8, right. But ïf I use the "normal character"
(not the corresponding entity) in the html source and my colleague
manually switches the encoding to the "Central European (ISO)", which
means iso-8859-2, voila, he sees the character well .... but tell this
to do to all people abroad .... :-)

I am pretty sure I have the meta-tag o.k. because I see the characters
exaxtly as I should on my windows machine (and on many others close to
me), even if the default codepage in Czech editions of windows is
cp-1250 which is different one. Yes, it differs only in few characters,
but I tried them, too - with no problems.

I would agree, that if my colleague would have not fonts properly
installed, he should see strange characters. But why are the characters
implicitly converted on his side ? And why on many computers ? Is it
possible it does his proxy ?

Thanks,

David


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4
David,

David Komanek <ko*****@natur. cuni.cz> wrote in message news:<3f******* *************** *@news.frii.net >...
Hi all,

thank you for the responses. Unfortunately my colleague is abroad, in
Netherlands and I have no possibility to play with his compoter (and all
computers in his department, too :-) But What I can tell for sure is
that I have the appropriate meta-tag in the page: iso-8859-2. He says he
has iso-8859-1 is his setting what he sees in the "view|encod ing" menu
as selected.


If you would let us know the URL it would be easier for us to
help you.
Any way, the above happens often with Russian too for the following reason:
- author created good page with correct META...charset=
- he placed .html to the Web Server of his Internet Provider
- The Web Server of the Provider is configured in such a way that
it places Charset=iso-8859-1 ("Western European") into
HTTP Header that is sent along with the page itself to a reader
( http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html )

- HTTP Header, but the standards, has higher priority than META...charset=
so browser gets it as a iso-8859-1 page!

So your friend needs to ask Web Server people if they do the above.
For example, my Internet Provider, CompuServe, does NOT fill our
Charset field of HTTP Header, so in my files META...charset=
works OK.

There is a test page that shows HTTP Header, so:
- create a Web page *without* META...charset= in it
- place it to the Web Server
- go to this page, get the screen with HTTP Header and see
what is the value of "Charset" field:
http://www.delorie.com/web/headers.html

If you do the above for _my_ page where there is no META...charset=
http://ourworld.compuserve.com/homep...r/test1251.htm
you will see that CompuServe leaves Charset field empty...
--
Regards,
Paul Gorodyansky
"Cyrillic (Russian): instructions for Windows and Internet":
http://ourworld.compuserve.com/homepages/PaulGor/
Jul 20 '05 #5
David Komanek wrote:

Hi all,

thank you for the responses. Unfortunately my colleague is abroad, in
Netherlands and I have no possibility to play with his compoter (and all
computers in his department, too :-) But What I can tell for sure is
that I have the appropriate meta-tag in the page: iso-8859-2. He says he
has iso-8859-1 is his setting what he sees in the "view|encod ing" menu
as selected. And all the Czech characters he sees converted to the
english equivalents.


I have ISO-8859-2 Test Page (because I work as Software I18n engineer),
so you can ask your friend to check how it is shown using *my*
Provider who does not fill out Charset of HTTP Header:
http://ourworld.compuserve.com/homep...gor/8859-2.htm

--
Regards,
Paul Gorodyansky
"Cyrillic (Russian): instructions for Windows and Internet":
http://ourworld.compuserve.com/homepages/PaulGor/
Jul 20 '05 #6
Paul Gorodyansky wrote:
David,

David Komanek <ko*****@natur. cuni.cz> wrote in message news:<3f******* *************** *@news.frii.net >...
Hi all,

thank you for the responses. Unfortunately my colleague is abroad, in
Netherlands and I have no possibility to play with his compoter (and all
computers in his department, too :-) But What I can tell for sure is
that I have the appropriate meta-tag in the page: iso-8859-2. He says he
has iso-8859-1 is his setting what he sees in the "view|encod ing" menu
as selected.

If you would let us know the URL it would be easier for us to
help you.
Any way, the above happens often with Russian too for the following reason:
- author created good page with correct META...charset=
- he placed .html to the Web Server of his Internet Provider
- The Web Server of the Provider is configured in such a way that
it places Charset=iso-8859-1 ("Western European") into
HTTP Header that is sent along with the page itself to a reader
( http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html )

- HTTP Header, but the standards, has higher priority than META...charset=
so browser gets it as a iso-8859-1 page!

So your friend needs to ask Web Server people if they do the above.
For example, my Internet Provider, CompuServe, does NOT fill our
Charset field of HTTP Header, so in my files META...charset=
works OK.


Is it possible that you might also get 8859-1 because the client sends
this in the Accept-charset request header? Without providing for
alternatives, and regardless of server configuration?
There is a test page that shows HTTP Header, so:
- create a Web page *without* META...charset= in it
- place it to the Web Server
- go to this page, get the screen with HTTP Header and see
what is the value of "Charset" field:
http://www.delorie.com/web/headers.html


OT: The above URL is an example of an application that is broken by
Verisign's implementing "sitefinder ".

Regards
Stephen

Jul 20 '05 #7
Hi,

Stephen wrote:

Paul Gorodyansky wrote:
David,

David Komanek <ko*****@natur. cuni.cz> wrote in message news:<3f******* *************** *@news.frii.net >...
Hi all,

thank you for the responses. Unfortunately my colleague is abroad, in
Netherlands and I have no possibility to play with his compoter (and all
computers in his department, too :-) But What I can tell for sure is
that I have the appropriate meta-tag in the page: iso-8859-2. He says he
has iso-8859-1 is his setting what he sees in the "view|encod ing" menu
as selected.

If you would let us know the URL it would be easier for us to
help you.
Any way, the above happens often with Russian too for the following reason:
- author created good page with correct META...charset=
- he placed .html to the Web Server of his Internet Provider
- The Web Server of the Provider is configured in such a way that
it places Charset=iso-8859-1 ("Western European") into
HTTP Header that is sent along with the page itself to a reader
( http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html )

- HTTP Header, but the standards, has higher priority than META...charset=
so browser gets it as a iso-8859-1 page!

So your friend needs to ask Web Server people if they do the above.
For example, my Internet Provider, CompuServe, does NOT fill our
Charset field of HTTP Header, so in my files META...charset=
works OK.


Is it possible that you might also get 8859-1 because the client sends
this in the Accept-charset request header? Without providing for
alternatives, and regardless of server configuration?


No, not really. First - and it's easy to verify - many browsers - and
MS Internet Explorer is one of them - do *not* fill out Accept-Charset
field - you can check it for example using "CGI Test Script" link
here: http://koi8.pp.ru/frame.html?htmlreq.html

Second, Accept-Charset is for different reason - when server has
*several* variants of the same page, say one contains same Russian
text in KOI8-R encoding, another - in Windows-1251 encoding, then
a browser via Accept-Charset=koi8-r tells the server what it
can take. Server can not *make* a document to be KOI8-R if it does not
havev such. Same in our case - if server contains ISO-8859-2
document and browser (f.e. Mozilla) requests ISO-8859-1, then
it does not mean at all that server will send existing -2 document
as -1.

--
Regards,
Paul Gorodyansky
"Cyrillic (Russian): instructions for Windows and Internet":
http://ourworld.compuserve.com/homepages/PaulGor/
Jul 20 '05 #8
Paul Gorodyansky wrote:
Hi,

Stephen wrote:
Paul Gorodyansky wrote:
David,

David Komanek <ko*****@natur. cuni.cz> wrote in message news:<3f******* *************** *@news.frii.net >...
[...snip...]


Is it possible that you might also get 8859-1 because the client sends
this in the Accept-charset request header? Without providing for
alternative s, and regardless of server configuration?


No, not really. First - and it's easy to verify - many browsers - and
MS Internet Explorer is one of them - do *not* fill out Accept-Charset
field - you can check it for example using "CGI Test Script" link
here: http://koi8.pp.ru/frame.html?htmlreq.html

Second, Accept-Charset is for different reason - when server has
*several* variants of the same page, say one contains same Russian
text in KOI8-R encoding, another - in Windows-1251 encoding, then
a browser via Accept-Charset=koi8-r tells the server what it
can take. Server can not *make* a document to be KOI8-R if it does not
havev such. Same in our case - if server contains ISO-8859-2
document and browser (f.e. Mozilla) requests ISO-8859-1, then
it does not mean at all that server will send existing -2 document
as -1.

Of course. Thanks for the commentary. I did notice that Gecko-based
browsers (Netscape 7.0, Moz 1.4, Firebird) do send Accept-charset. And
contrary to what I was remembering, you are right about IE: it does not.
Thanks again,
Stephen

Jul 20 '05 #9
Thank you all for your help.

In the meantime I got the workaround for my problem by recoding the
pages to utf8, as was suggested here. Because the encoding is made by
a module in Apache on the server, where the implicit codepage served
to clients is iso-8859-2, I just prefixed the pages with /utf8, wich
tells the server to use the explicit encoding "utf-8". So, for
example, one of the recoded pages, where is the problem is

http://www.natur.cuni.cz/utf8/fem_mo...index.php?id=4

the original one is now as

http://www.natur.cuni.cz/fem_modflow..._test.php?id=4

Please, colud somebody form non-central/eastern-european region tell
me what (s)he sees on the page between lines

"Organizing Committee"

and

"Institute of Hydrogeology, Engineering Geology and Applied
Geophysics" ?

The should be the name "Zbynek Hrkal", where the "e" has a special
decoration (sthg. like tilde, but not exactly, I have no idea how to
call this letter in english language, sorry (does anybody know ?)). I
see it right in both encodings, with MS IE 6, Netscape 7.1, Mozilla
..... but my colleague in Netherlands sees it well only in utf8, not in
original iso-8859-2. In the latter case he sees "regular e" instead.

I do not know how to ge the http header from the server. When I
connect to port 80 of the webserver via unix telnet and type

GET /fem_modflow/index_test.php? id=4

I get just the source of the webpage, no http header lines:

# telnet www.natur.cuni.cz 80
Trying 195.113.56.1...
Connected to tao.natur.cuni. cz.
Escape character is '^]'.
GET /fem_modflow/index_test.php? id=4
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
.....
.....
.....

Thanks again for your comments.

With best regards,

David Komanek
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2226
by: Frank | last post by:
Hello, I'm a total newbie on Javascript, and with a lot of help and some copy and paste managed to get things running. On my site: http://home.wanadoo.nl/homepage I use a form from Bravenet. This works fine. Unfortunately some persons fill in their e-mail address instead of the URL of their page. Checking is done on empty fields but...
24
3474
by: Charles Crume | last post by:
Hello; My "index.htm" page has 3 frames (content, navigation bar, and logo). I set the "SRC" of the "logo" frame to a blank gif image and then want to change it's contents after the other two frames have been loaded by using a javascript statement from the "navigation" frame, as shown below: top.window.ccs_logo.src =...
11
1772
by: Dag Sunde | last post by:
We have this web-app that requires Javascript to be enabled in the UA (this is okay'ed by our customer). Now I want to make a "pre" page before the login screen, informing the user that he/she must have JS turned on. Problem is that I would prefer to show this page only if JS isn't on. (and hence, I have a "Chicken/Egg" problem). If...
2
2276
by: Ozer | last post by:
Hi friends, I wanna ask something. I use javascript menu on my user interface. And the js files contains special(turkish) character. I need to use codepage=1254 attribute in my @Page tag. If i don't use it. Javascript menu and functions fail. But if i add this atrribute, after i posted the form, all of the special(turkish) characters...
2
2339
by: John Dalberg | last post by:
The below html validates correctly on w3.org's html validator when the file has an html extension. When the same file gets an aspx extension, I get the error below from the validator. This tells me that ASP.NET is changing the character encoding in the http header. How can this be corrected so that aspx pages validate correctly? Error...
6
2244
by: Dennis Gearon | last post by:
This is what has to be eventually done:(as sybase, and probably others do it) http://www.ianywhere.com/whitepapers/unicode.html I'm not sure how that will affect LIKE and REGEX. ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? ...
9
2261
by: Velvet | last post by:
I'm trying to convert some JavaScript to C# and don't know how to get the character code of a character in a string. in JavaScript it is as follows: for( i = 0; i < email.length; i++) { var fs = email.charCodeAt(i); uniemail = uniemail + '&#' + fs + ';';
44
9446
by: Kulgan | last post by:
Hi I am struggling to find definitive information on how IE 5.5, 6 and 7 handle character input (I am happy with the display of text). I have two main questions: 1. Does IE automaticall convert text input in HTML forms from the
2
15604
by: stup | last post by:
Hi! I have a small javascript snippet that does the following: // an entire html document is in here data = "\u003c!DOCTYPE html PUBLIC \u0022-//W3C//DTD XHTML 1.1 Strict//EN\u0022\n ...."; newwin = window.open("", "outputwin", ""); newwin.document.write(data);
0
7941
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7997
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6320
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5247
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3680
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2130
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1238
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
971
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.