Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any places where utf8 vs. utf-8 vs. UTF8 vs. UTF-8 makes a difference? [closed]

In many different code environments' official documentation I see UTF-8 expressed either as upper- or lower- case, and also with and without the dash. Are there any places where one or the other is important to use?

Some places where these strings are found include:

  • The PHP manual in reference to header() arguments (HTTP headers)
  • The PHP manual in reference to PHP function arguments
  • The PHP manual in reference to internal configuration
  • The MySQL manual in reference to configuration
  • Python 2 code encoding declaration
  • Bash locale configuration
  • HTML meta tags
  • XML doctypes
like image 310
dotancohen Avatar asked Dec 28 '22 06:12

dotancohen


2 Answers

This is indeed wildly different. One place will accept only one form; the other place will only accept the other.

Listing here which is correct in which situation is not a good idea - it would be a huge and pointless open-ended list. Simply always look up in the respective documentation which form(s) is/are accepted for the specific situation.

like image 84
Pekka Avatar answered Dec 31 '22 14:12

Pekka


The official registry of encodings defines the names as case-insensitive and the spelling as UTF-8 (UTF8 isn’t even a valid alias). It is highly unlikely that any software that can deal with UTF-8 would not recognize the name UTF-8. So in all places, it is important to use UTF-8 and not UTF8.

Since the names are case-insensitive, documentation may use any casing. Software that imposes case restrictions on them would be seriously broken, and I don’t see why would assume that such software exists. Variation in documentation does not mean that some specific casing of letters must be used.

like image 37
Jukka K. Korpela Avatar answered Dec 31 '22 12:12

Jukka K. Korpela