49

Which of the two is correct terminology?

vvvvv
  • 25,404
  • 19
  • 49
  • 81
moo
  • 7,619
  • 9
  • 42
  • 40
  • 3
    I asked google :) "Results 1 - 10 of about 50,400,000 for UTF8. (0.13 seconds)" vs "Results 1 - 10 of about 140,000,000 for UTF-8" – Johannes Schaub - litb Apr 30 '09 at 23:49
  • 1
    @Ben Alpert: Why did you remove the utf8 tag? The question is about UTF-8 and UTF8. – Zifre Apr 30 '09 at 23:59
  • 2
    that's exactly why I changed all the utf8 tags into utf-8 tags a few days ago ;) – markus May 01 '09 at 00:22
  • @JohannesSchaub-litb That means nothing. Absolutely nothing. – Pacerier Feb 01 '12 at 11:40
  • The sad part is, given a language tag above, this could be an answerable question. – demongolem Jun 12 '14 at 18:21
  • 13
    This is not opinion-based. According to IANA, only "UTF-8" is correct: http://www.iana.org/assignments/character-sets/character-sets.xml Giving "UTF8" as charset can lead to serious problems: https://stackoverflow.com/a/24323842/2733244 – wortwart May 20 '15 at 08:01
  • 1
    @billthelizard I don't believe that this is opinion based. I believe that the question should clarify the context – sdc Mar 17 '16 at 21:56
  • @sdc 1. The question *doesn't* clarify the context. 2. Look at the accepted answer. It starts with "That depends on where you use it..." This is an opinion based question. – Bill the Lizard Mar 18 '16 at 16:06
  • Thanks @BilltheLizard, I created a more specific question to avoid the confusion. [UTF-8 vs UTF8](http://stackoverflow.com/questions/36094939/utf-8-vs-utf8-in-xml-files) – sdc Mar 18 '16 at 22:11
  • 1
    I remember mysql's (ver 6+) java driver (as a bug?) allowed utf8 and threw exception on utf-8 (and required small case). – hkoosha Feb 27 '17 at 10:39
  • According to https://encoding.spec.whatwg.org/#names-and-labels UTF-8 is the canonical name, but utf8 is an alias. – Dave Burton Aug 04 '20 at 14:57

5 Answers5

45

That depends on where you use it...

The name of the encoding is UTF-8.

A dash is not valid to use everywhere, so for example in .NET framework the property of the System.Text.Encoding class that returns an instance of the UTF8Encoding class that handles the UTF-8 encoding is named UTF8.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
26

It's definitely UTF-8. UTF8 is only used commonly in places where a dash is not allowed (programming language indentifiers) or because people are too lazy.

Zifre
  • 26,504
  • 11
  • 85
  • 105
18

Following the RFC standard the answer is UTF-8

http://www.ietf.org/rfc/rfc3629

backslash17
  • 5,300
  • 4
  • 31
  • 46
6

I believe according to the Unicode Consortium, it's UTF-8.

nivnad
  • 696
  • 1
  • 5
  • 10
6

Also UTF-8 (great and thorough explanation of UTF-8)

Dan Esparza
  • 28,047
  • 29
  • 99
  • 127