Do I need to use ascii codes for french accents in a html page? [duplicate]

StackOverflow https://stackoverflow.com/questions/22819600

  •  26-06-2023
  •  | 
  •  

Вопрос

  1. société
  2. société

Which among the two should be used in html page and why? Can anyone please let me know the importance of it??

Это было полезно?

Решение

If your source file is correctly encoded as UTF-8, you can simple write "société". Basicly you can use any character you would ever want, when you use UTF-8 encoding.

But, if you for some reason don't use UTF-8, but use for instance ASCII encoding, you are forced to write é This is a very good reason to check you are using UTF-8 encoding in all your source files.

Where you need to use html entities is for instance:

  • & which is written &
  • < which is written &lt;
  • > which is written &gt;

But remember it depends on, where in the html code. In attribute values, you also need to replace:

  • " with &quot;

This is what I remember of the top of my head. But use a html validator, it will tell you, if you have problems of this kind.

Другие советы

No, you can (and should) use UTF-8 encoding.

Escapes are for text that gets parsed or processed somehow. Escape characters or numeric character references (NCRs) prevent text from getting confused with a symbol that the interpreter/compiler/etc might take as a syntactical instruction.

If you want some official documentation for when to use NCRs:

http://www.w3.org/International/questions/qa-escapes

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top