473,581 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

@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=ut f-8" >

it works....

Boring!

What's wrong?

Thank you
--
François Patte
Université Paris 5 - Paris
Oct 6 '07 #1
4 2867
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************ *****@yahoDELET ETHATo.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.stylesh eets 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.stylesh eets 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=ut f-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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6187
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 http-equiv="Content-Type" content="text/html; charset=UTF-8"> Here is what I have tried so far: - Regular html page: charset is properly...
12
3736
by: lawrence | last post by:
How do I get PHP to tell the server that when I echo text to the screen, I need for the text to be sent as UTF-8? How does Apache know the right encoding when all the text is being generated by PHP? If I build a content management system (I have) and I make sure that all input is encoded as UTF-8, how will the server know that the text in the...
8
3679
by: Ben Sharvy | last post by:
I don't reallly understand charsets, but I see that you are supposed to declare one. I am putting a paper up in HTML. It uses some special characters, like umlauts and diacriticals. The biggest problem I've had with it is creating characters with lines over them (macrons), as is done to indicate a long vowel sound, for example. There is no way...
25
2999
by: Andrew Thompson | last post by:
I was recently loading an HTML editor so I could find the charcode of that particularly obscure character using the editor's 'insert special character' dialog. It occured to me there had to be a better way. There are probably dozens, but here is my solution.. http://www.physci.org/codes/charset.jsp
35
4599
by: The Bicycling Guitarist | last post by:
My web site has not been spidered by Googlebot since April 2003. The site in question is at www.TheBicyclingGuitarist.net/ I received much help from this NG and the stylesheets NG when updating the code before then. My host's tech guy just sent me the following. Isn't it okay to specify UTF-8 as the charset in the HTTP headers at the server...
28
3213
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 still use ISO-8859-1. What did I do wrong? Thanks,
1
1359
by: Danny | last post by:
What can I enter into the validatioon rule property for a bound text box that points to a field. the field is text and will stay that way. how can I force the user to enter either nothing or a decimel number that must have 2 decimel numbers after and only up to 7 digits before decimel. Thanks again
2
1306
by: reynard.michel | last post by:
Hi, I would like to translate an XML ISO-8859-1 document in UTF-8. For this I wrote the following XSL <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8" indent="yes"/> <xsl:template match="*">
7
5972
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 TEXT will be inserted into the HTML before sending to IE. The problem is 1) Can I specify special charset for some component, e.g. <span...
0
7876
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7804
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8310
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...
1
7910
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
3809
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...
0
3832
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2307
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
1409
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1144
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.