471,582 Members | 1,475 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

@charset rule

Bonjour,

I am wondering why the @charset rule is not working for me.

I put at the early beginning of my index.css file:

@charset "utf-8";

no line before....

and in every html file:

<link rel="STYLESHEET" href="index.css">

Everything is OK for all style definitions made in the index.css
(background, fonts style, size, and so on....

Only the charset definition is not working.... Browsers always return
ISO8859-1!!!

If I add this line in html files:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

it works....

Boring!

What's wrong?

Thank you
--
François Patte
Université Paris 5 - Paris
Oct 6 '07 #1
4 2802
François Patte wrote:
Bonjour,

I am wondering why the @charset rule is not working for me.

I put at the early beginning of my index.css file:

@charset "utf-8";

no line before....

and in every html file:

<link rel="STYLESHEET" href="index.css">

Everything is OK for all style definitions made in the index.css
(background, fonts style, size, and so on....

Only the charset definition is not working.... Browsers always return
ISO8859-1!!!
You didn't specified what "returns ISO8859-1" means.
I guess that you may not have understood that the charset directive
defines the charset of the CSS file, not the HTML file.

--
If you've a question that doesn't belong to Usenet, contact me at
<ta*****************@yahoDELETETHATo.fr>
Oct 6 '07 #2
Scripsit François Patte:
I did not understand that this declaration was limited
to the css file only...
That's not surprising; virtually all people get very confused with charset
issues when they start working with them, but we can learn to keep the
confusion at a manageable level.
And now I don't understand why it is necessary to declare the charset
of the css file.
Mostly it isn't. You normally use just ASCII characters there, and then the
charset mostly does not matter.

It matters if you use, say, a font name containing non-ASCII characters,
like

body { font-family: "François", sans-serif; }

(just assuming that you expect a font called "François" to exist somewhere).
People have used e.g. font names containing Japanese characters.

If this still puzzles you, c.i.w.a.stylesheets would be the right group to
ask about CSS issues.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Oct 6 '07 #3
Jukka K. Korpela a écrit :
Scripsit François Patte:
>I did not understand that this declaration was limited
to the css file only...

That's not surprising; virtually all people get very confused with
charset issues when they start working with them, but we can learn to
keep the confusion at a manageable level.
>And now I don't understand why it is necessary to declare the charset
of the css file.

Mostly it isn't. You normally use just ASCII characters there, and then
the charset mostly does not matter.

It matters if you use, say, a font name containing non-ASCII characters,
like

body { font-family: "François", sans-serif; }

(just assuming that you expect a font called "François" to exist
somewhere). People have used e.g. font names containing Japanese
characters.

If this still puzzles you, c.i.w.a.stylesheets would be the right group
to ask about CSS issues.
Thanks for this clarification and for the address.

--
François Patte
Université Paris 5 - Paris
Oct 7 '07 #4
On Sat, 6 Oct 2007, François Patte wrote:
I put at the early beginning of my index.css file:
@charset "utf-8";

Only the charset definition is not working.... Browsers always return
ISO8859-1!!!
Do you actually have some non-ASCII characters in your file?
If I add this line in html files:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
it works....
What does this mean - "it works"? The fake <meta http-equivis just
an imitation of the real HTTP header.
http://www.unics.uni-hannover.de/nht...a-http-equiv.1
http://www.unics.uni-hannover.de/nht...a-http-equiv.2

Read
http://www.w3.org/International/O-HTTP-charset
how the define the charset parameter in the HTTP header.
Oct 8 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by CJ Oxx | last post: by
12 posts views Thread by lawrence | last post: by
25 posts views Thread by Andrew Thompson | last post: by
35 posts views Thread by The Bicycling Guitarist | last post: by
28 posts views Thread by Xiaotian Sun | last post: by
1 post views Thread by Danny | last post: by
2 posts views Thread by reynard.michel | last post: by
7 posts views Thread by gmclee | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by
1 post views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

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.