💾 Archived View for rawtext.club › ~sloum › geminilist › 003095.gmi captured on 2020-11-07 at 03:21:14. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
John Cowan cowan at ccil.org
Sat Nov 7 00:28:16 GMT 2020
- - - - - - - - - - - - - - - - - - -
This post is to suggest that servers currently using file extensions todetermine MIME-types switch to libmagic. This C library analyzes thecontent of a file (by name, by file descriptor, or by looking at a buffercontaining the content) and can provide a MIME-type and an encoding. Thislibrary is behind the `file` command on Linux, FreeBSD, and NetBSD (but notOpenBSD), and there are interfaces for at least Python, Rust, and Go, plusa version for Windows. If you are testing (or serving!) on a Mac, useHomebrew or Guix. Googling for "libmagic" and some keyword will probablyfind more.
Obviously, using libmagic is slower than just comparing a file extension toa list of known extensions. But Gemini servers are not, in general,high-volume, and it has the advantage of being maintained by an outsidegroup that is quite good about accepting information about new fileformats. This means that Gemini servers can serve content in most formatswithout a problem.
Unfortunately, at the moment `file --mime` will report either "text/plain;charset=utf-8" or "text/plain; charset=us-ascii" instead of text/gemini.So an interesting question is: how can a text/gemini file best beidentified by its content? It doesn't have to be infallible, because it canbe backed up by checking the extension.
John Cowan http://vrici.lojban.org/~cowan cowan at ccil.orgThe native charset of SMS messages supports English, French, mainlandScandinavian languages, German, Italian, Spanish with no accents, andGREEK SHOUTING. Everything else has to be Unicode, which means you getonly 70 16-bit characters in a text instead of 160 7-bit characters.-------------- next part --------------An HTML attachment was scrubbed...URL: <https://lists.orbitalfox.eu/archives/gemini/attachments/20201106/a3ebaca9/attachment.htm>