jeltsch's blog

How to determine and convert text file encoding (file, enca, iconv)

To determine the file type of the file "sample.txt" you just type:
file sample.txt
Usually it'll tell you only that it is a text file. To get to know more about the encoding type:
enca -L none sample.text
The -L switch tells the program what language is used in the file. If you don't know, just use none.
To convert the encoding from ISO-8859-1 (latin1) to UTF-8:
iconv --from-code=ISO-8859-1 --to-code=UTF-8 sample_iso8859-1.txt > sample_utf-8.txt

File permissions on html server (recursive chmod) differentiating between files and directories

I recursively screwed up the file permissions in my html servers root directory. To fix it I needed to deploy some "advanced" chmod settings. Obviously I want to treat directories and files differently. I didn't come up with a better solution than the following:

chmod -R u=rw-x,g=rw-x,o=r-wx *
chmod -R a+X *

Old Macs and USB support

We have a few legacy Macintosh computers at work which are still running different flavours of MacOS 9. Although these machines have USB ports, they are mostly non-functional. I think MacOS 9.0 was the first version that supported USB mass storage devices, but apparently support has been shaky until and including version 9.2.2. Apparently the various updates to MacOS 9 mainly addressed the problems with USB (and firewire) support. At least for one of these machines (running MAcOS 9.2.2) I managed to fix the USB support.

Pages