2
<? xml version="1.0" encoding="utf-8"?>

As per W3C standards we have to use utf-8 encoding, Why can not we use utf-16 or any other which are in the encoding format?

Whats the difference between utf-8 encoding and rest of the other encoding formats.

一二三
  • 21,059
  • 11
  • 65
  • 74
  • 2
    UTF-8 is *the* standard for the web, see e.g. http://stackoverflow.com/questions/4655250/difference-between-utf-8-and-utf-16 for differences between -8 and -16 – Pekka Jan 03 '16 at 10:03

2 Answers2

5

XHTML doesn't require UTF-8 encoding. As explained in this section of the specification, any character encoding can be given -- but the default is UTF-8 or UTF-16.

一二三
  • 21,059
  • 11
  • 65
  • 74
0

According to w3 school there are lots of character encodings to help browser to understand. UTF-8 - Character encoding for Unicode ISO-8859-1 - Character encoding for the Latin alphabet.

There are several ways to specify which character encoding is used in the document. First, the web server can include the character encoding or "charset" in the Hypertext Transfer Protocol (HTTP) Content-Type header, which would typically look like this:[1]

charset=ISO-8859-4

This method gives the HTTP server a convenient way to alter document's encoding according to content negotiation; certain HTTP server software can do it, for example Apache with the module mod_charset_lite.[2]

  • The question asks "why not use utf-16?" and "what's the difference between utf-8 and other encodings?". It appears to me that your post does not answer any of those questions. – abhuse Dec 03 '18 at 17:11