TIL (about the Dark Arts of HTML)
-
@Bulb said in TIL (about the Dark Arts of HTML):
But does it have actual semantic significance? That is, is there an application that, upon seeing application/epub+zip will say that it has no clue what epub is, but it does know what a zip is, so it will offer the user to open it as a zip archive?
Also, how do you reduce image/svg+xml to application/xml without already knowing that format?I guess the closest thing there is for that is RFC6838: you're not supposed to use a +suffix unless the suffix itself is already declared as a media type. Dunno how rigorous IANA is about rejecting applications to register
example/something+xml
for something that isn't actually XML, but there'd probably at least be discussion.
-
@Bulb said in TIL (about the Dark Arts of HTML):
The formats that have the same prefix before / often don't share anything, so that's not useful.
My point is that you can add more qualifiers to the MIME type, whether via
/
,+
, or some other legal character. Probably+
for consistency with what everyone's done so far. But truth be hold I have not read the RFC so I don't know what restrictions it applies.The whole point is moot though. The application consuming a file should try and parse its contents, probably looking for some magic number in a well known position, file extensions be damned. After all, everyone's doing defensive coding, right?
-
Well, I think the higher specificity is useful.
To answer the preceding points…
application/epub vs application/epub+zip - you sort of need the qualifier in case you ever wanted to support application/epub+tgz or application/epub+7z.
When you have a bundle that comprises a thing, being able to denote the container type is useful if you’re ever going to support more types of things - for ePub it’s maybe not that useful but encouraging the behaviour of “I have some data in a format, but it’s wrapped in another format” is useful to be able to convey.
image/svg+xml is a weird case because in that case XML isn’t so much a container as the same format - an SVG is a legal XML file, but obviously not always the other way around. Personally I’d be fine here with image/svg on its own but I get why it has the +xml qualifier - and the fact it is specifically an image rather than a generic XML blob is why you need the separation from application/xml.
Video is, as remarked, a shitshow. But even there, ability to reflect “I have this content in this format, wrapped in this container” would be valuable.
-
@Arantor I think for both
+xml
and+zip
it's more "Applications which generically handle the + format can do something sensible with this". Generic zip handling applications can extract resources fromapplication/foo+zip
. XML processing tools can ingest any+xml
file.
-
@PleegWat true, but it’s still useful to know the container format, if anything that’s why it’s useful to explicitly know the container format because you know other tools may be able to open it.
-
@Zecc said in TIL (about the Dark Arts of HTML):
The application consuming a file should try and parse its contents, probably looking for some magic number in a well known position, file extensions be damned.
That's the most practical approach, also because it does not depend on everybody agreeing on anything. It is even implemented in most cases (though not in Excel, as evidenced by the comment that started this discussion).
@Arantor said in TIL (about the Dark Arts of HTML):
application/epub vs application/epub+zip - you sort of need the qualifier in case you ever wanted to support application/epub+tgz or application/epub+7z.
When you have a bundle that comprises a thing, being able to denote the container type is useful if you’re ever going to support more types of things - for ePub it’s maybe not that useful but encouraging the behaviour of “I have some data in a format, but it’s wrapped in another format” is useful to be able to convey.
Yes, that is useful. But I was talking about a different—admittedly not very common, but very useful—use-case, where, in absence of a specific handler, the document may be usefully treated as another type. A
.drawio.png
file is a diagrams.net (draw.io) diagram that can be edited in that application, but it is also a valid PNG image that can be displayed by any browser or image viewer.image/svg+xml is a weird case because in that case XML isn’t so much a container as the same format - an SVG is a legal XML file, but obviously not always the other way around. Personally I’d be fine here with image/svg on its own but I get why it has the +xml qualifier - and the fact it is specifically an image rather than a generic XML blob is why you need the separation from application/xml.
Where I've seen such suffix to be useful is if you want to have a generic validator in front of the application to protect from malformed, and possibly malicious, inputs. Usually such applications simply take
application/xml
andapplication/json
, but sometimes there is a reason to further distinguish different inputs and thenapplication/bflmpsvz+xml
vs.application/bflmpsvz+json
comes in handy.Video is, as remarked, a shitshow. But even there, ability to reflect “I have this content in this format, wrapped in this container” would be valuable.
… It would have been possible to define the formats like
video/v8+matroska
orvideo/h265+mp4
to encode both the codec and the container, but nobody did and even the mime-types for the containers are not consistent, so we've got to keep all the shreds.
-
@Bulb Video generally deals with separate codecs for audio and video though.
-
@PleegWat there could be more
+
or other separators as needed. But someone would have to specify the naming and then all the people would have to update their clients and servers to understand it and they ain't going to because they don't like each other or simply because lazy.
-
@PleegWat said in TIL (about the Dark Arts of HTML):
@Bulb Video generally deals with separate codecs for audio and video though.
I don't really know, FFMPEG does it for me.
-
TIL "Pie Day", March 14th, is also Albert Einstein's birthday.
-
@Bulb said in TIL (about the Dark Arts of HTML):
It would have been possible to define the formats like video/v8+matroska or video/h265+mp4
Apropos, a recent with video mime-type:
We switched the video output from MP4 to Matroska (still the same codec, just different container), because if the generation was stopped, the partially written MP4 was not playable, but the partially written Matroska (
.mkv
) was. Except the video is supposed to play in browser too, and setting the ‘correct’ mime type,video/matroska
(orvideo/x-matroska
) did not work. What did work was setting the mime type tovideo/mp4
. Then it played in Chrome-based browsers and Safari (Firefox apparently does not support Matroska at all, only its WebM subset).
-
@Zecc said in TIL (about the Dark Arts of HTML):
TIL "Pie Day", March 14th, is also Albert Einstein's birthday.
It's also Stephen Hawking's deathday.
-
I'm surprised no one corrected me when I typed Pie instead of Pi.
-
@Zecc said in TIL (about the Dark Arts of HTML):
I'm surprised no one corrected me when I typed Pie instead of Pi.
We accept both flavors here.
-
@Watson said in TIL (about the Dark Arts of HTML):
@Bulb said in TIL (about the Dark Arts of HTML):
But does it have actual semantic significance? That is, is there an application that, upon seeing application/epub+zip will say that it has no clue what epub is, but it does know what a zip is, so it will offer the user to open it as a zip archive?
Also, how do you reduce image/svg+xml to application/xml without already knowing that format?I guess the closest thing there is for that is RFC6838: you're not supposed to use a +suffix unless the suffix itself is already declared as a media type. Dunno how rigorous IANA is about rejecting applications to register
example/something+xml
for something that isn't actually XML, but there'd probably at least be discussion.what stops me from writing whatever on my mime headers?
-
@sockpuppet7 said in TIL (about the Dark Arts of HTML):
@Watson said in TIL (about the Dark Arts of HTML):
@Bulb said in TIL (about the Dark Arts of HTML):
But does it have actual semantic significance? That is, is there an application that, upon seeing application/epub+zip will say that it has no clue what epub is, but it does know what a zip is, so it will offer the user to open it as a zip archive?
Also, how do you reduce image/svg+xml to application/xml without already knowing that format?I guess the closest thing there is for that is RFC6838: you're not supposed to use a +suffix unless the suffix itself is already declared as a media type. Dunno how rigorous IANA is about rejecting applications to register
example/something+xml
for something that isn't actually XML, but there'd probably at least be discussion.what stops me from writing whatever on my mime headers?
Nothing, but you usually want to set something that will make the client behave the way you want. Which sometimes requires setting something that makes no sense, see above.
-
@Zecc said in TIL (about the Dark Arts of HTML):
I'm surprised no one corrected me when I typed Pie instead of Pi.
I thought you were making fun.
-
TIL by default most people are using the seam ripper tool upside down...
-
TIL there's a thing for ripping seams.
-
@Zecc I've usually seen it included in the accessories for a sewing machine. So you can fix your mistakes.
-
@Bulb Skillful as I am, my mistake would be trying to use a sewing machine in the first place.
-
@Zecc I did a couple of times. It ain't hard.
-
@Zecc said in TIL (about the Dark Arts of HTML):
TIL there's a thing for ripping seams.
The fields of computers and sewing intersect with the threadripper.
-
We had a combined class here when I was at school, “design and technology” which rotated through a whole bunch of disciplines, including home economics (cooking, food storage, food hygiene, preservation), textiles (including using a sewing machine), woodwork, metalwork, electronics, product design, packaging design, all sorts of things.
The idea being that you do a rudimentary in everything and specialise for your final two years in a single discipline. (I did electronics, my final project was building a motion based alarm card that you could fit into a desktop PC, with a physical key for the backplate to turn it off. I could have drawn power from the mobo but I just had it battery backed instead.)
-
@Atazhaia said in TIL (about the Dark Arts of HTML):
@Zecc said in TIL (about the Dark Arts of HTML):
TIL there's a thing for ripping seams.
The fields of computers and sewing intersect with the threadripper.
It all started with programmable looms.
-
@Carnage I have visited a textile manufacturer still using old-school looms programmed with punched tapes. Interesting to see work.
-
@Atazhaia Glad to hear there are still people who don't fix what ain't broken out there.
-
@Carnage said in TIL (about the Dark Arts of HTML):
It all started with programmable looms.
I'm Bobbin Threadbare. Are you my mother?
-
@Zecc said in TIL (about the Dark Arts of HTML):
@Carnage said in TIL (about the Dark Arts of HTML):
It all started with programmable looms.
I'm Bobbin Threadbare. Are you my mother?
Lady Cygna is nowhere to be found. Perhaps by weaving the Transcendence draft you might rectify this.
-
@Bulb said in TIL (about the Dark Arts of HTML):
I did a couple of times. It ain't hard.