file types/data types/mime types

Discussion in 'Apple' started by Jd Lyall, May 31, 2006.

  1. Jd Lyall

    Jd Lyall Guest

    I am puzzled about something with osX.
    Why does it use the file extension for determining file type instead of
    looking into the file for the type?

    My Amiga used datatypes 15 years ago to determine what kind of file it
    was. If it was jpeg but named .gif, no problem. The jpeg program loaded it.

    For instance, I had a file on my desktop, an html file of instructions.
    It had no file extension so appeared on the desktop as a blank white
    rectangle. Re-named it 'html' so firefox showed up on the icon.

    I just renamed it 'jpg' and GraphicConverter tried to open it. It
    reported "The file 'foobar.jpg' is broken, the format is unknown or it
    isn't a graphics file.
    So, Graphic Converter can't open it."
    Then it gives a file dump, in hex and ascii which clearly shows it to be
    an html file.

    Why aren't data types or mime types implemented in the user interface?
    Are datatypes/mimetypes in the BSD itself? Cannot find it.
    Jd Lyall, May 31, 2006
    1. Advertisements

  2. Jd Lyall

    Jd Lyall Guest

    I don't know the 'old type/creator' system as I hardly ever used a Mac
    prior to osx.

    I'm talking about the file type data which IS inside the file. Like this
    jpeg, says "リ…�
    Jd Lyall, Jun 1, 2006
    1. Advertisements

  3. Jd Lyall

    Tom Stiller Guest

    I think you're referring to the "magic number" scheme which attempts to
    identify the type of a file using some text embedded in the file's
    contents. The scheme works in Mac OS X as well as it ever did (see the
    man pages for "file" and "magic") but fails when the file doesn't adhere
    to the requirements or the name refers to a directory or bundle.
    Tom Stiller, Jun 1, 2006
  4. Most files do not have file type data inside the file.
    Michelle Steiner, Jun 1, 2006
  5. Unfortunately, there is as yet no standard for including such
    information in all types of computer files. Until there is, identifying
    file types by their content will be hit or miss. Perhaps the move toward
    standardized file formats will lead the computer industry to come up
    with a standard for including basic metadata within files themselves so
    that they can be moved among different file systems without having to
    worry about filename extensions and such.
    Neill Massello, Jun 1, 2006
  6. Jd Lyall

    Hans Aberg Guest

    It turns out that it is difficult to achieve this, because
    computer programs often do not process whole files, but some substrings.
    Then the type information is lost anyway. One example, discussed much, is
    the use of the BOM sometimes put in the beginning of files to tell whether
    it is UTF-16 big or little endian. It does not work well in a UNIX
    environment, just causing problems in an encoding such as UTF-8.

    So it is unlikely that metadata will move into the files for general
    processing, but only to be used in special formats, as is the case now.
    Hans Aberg, Jun 2, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.