473,328 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,328 software developers and data experts.

Re: read charset of meta tag

Martin Honnen wrote:
....
On the other hand most browsers by now expose a property like
document.characterSet (Mozilla) or document.charset (IE) which should
give you the charset the browser has taken from the meta or from real
HTTP headers.
Is it true that these metatags have often different values compared to what
the browser actually uses? And the page author might have not a correct idea
of the character set, which the server is sending, thus believing that
putting something to metatags the server obeys him/her. The browsers in this
mess try to conclude the character set by examining the byte stream with
heuristic rules, getting often somewhat correct results.
I thought earlier that metatags are commands to the server: if I put
ISO-8859-10 to the tag, then the server transforms the page to that
characterset!

Eg javascript files on the server: I suspect most authors here have not 100
% reliable and true info which characterset they have. At least I have not
:)
Aug 28 '08 #1
1 1481
optimistx wrote:
Martin Honnen wrote:
...
>On the other hand most browsers by now expose a property
like document.characterSet (Mozilla) or document.charset
(IE) which should give you the charset the browser has
taken from the meta or from real HTTP headers.

Is it true that these metatags have often different values
compared to what the browser actually uses?
That is certainly possible as that browser will follow the HTTP headers
and take any character set declarations in the headers in preference to
anything else (as it required in HTTP). And it is certainly common for
the attributes of META elements to be at odds with HTTP headers (and
even at odds with document mark-up; how often do you see XHTML mark-up
contain a META element that attempts to assert that document to be
textt/html?).
And the page author might have not a correct idea of the
character set, which the server is sending, thus believing
that putting something to metatags the server obeys him/her.
Yes, misconceptions about web technologies are rife.
The browsers in this mess try to conclude the character set
by examining the byte stream with heuristic rules,
That has been observed (particularly with IE (at least up until 6)).
getting often somewhat correct results.
And some spectacularly wrong result, hence the observation of the
phenomenon.
I thought earlier that metatags are commands to the server:
For some servers they have been; the server would process the document
prior to sending and base the headers used on the META elements. But
that is not very common with servers.
if I put ISO-8859-10 to the tag, then the server transforms
the page to that characterset!

Eg javascript files on the server: I suspect most authors here
have not 100 % reliable and true info which characterset they
have.
Observing that some people don't know what they are doing is no reason
to assume 'most here' do not.
At least I have not
:)
Get yourself a web debugging proxy (Fiddler or Charles) or some other
tool that can show you the HTTP headers.

Richard.

Aug 28 '08 #2

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

Similar topics

4
by: CJ Oxx | last post by:
I have a problem with browser charset recognition when using PHP 4.1.2 (this is the PHP version which our hosting company provides). For charset recognition, I use the following meta-tag: <meta...
1
by: David Thomas | last post by:
Hi there, a while ago, I posted a question regarding reading japanese text from a text file. Well, since I solved the problem, I thought I'd post my solution for the benefit of other people with...
4
by: see_mun_lee | last post by:
I use asp to develop a web page to read an excel file containing Chinese Character then display it in the web page. Unfortunately, I cant display it!!! it will display (?????????). <META...
1
by: Nick Kew | last post by:
Someone just drew attention to an open bug report in Apache concerning shipping with an AddDefaultCharset set by default in httpd.conf. This leads to bogus charsets being served in many cases. ...
2
by: Reply Via Newsgroup | last post by:
Folks, I'm pretty sure it can be done, and I'm doing pretty good with my javascript so I'm pretty sure I just need a quick point in the right direction... If my web page is referenced in the...
28
by: Xiaotian Sun | last post by:
I added the following line to the header of my html file <meta http-equiv="content-type" content="text/html; charset=utf-8"> hoping browsers will use UTF-8 encoding. But all browsers I tried...
4
by: Rémi | last post by:
Question: How can you determine the character set used by a webpage you built? My understanding of the issue is that the character set used by an HTML file (or any other file, for that matter)...
7
by: gmclee | last post by:
Hi there, I am writing a program to load HTML from file and send it to IE directly. I've met some problem in charset setting. Most of HTML have charset "us-ascii", for some reason, some UNICODE...
2
by: vunet.us | last post by:
I translate my website to German and some ASCII characters are not translated by my browser. For example I see this: &#x00FC; I use charset: <meta http-equiv="Content-Type" content="text/html;...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.