What has you here today?    work history (html) about me tajik bookmarks

Character set chaos, as so often … GTK2 & Option, X11.app … Keyboard nerdiness. 7th of April, 2007 POST·MERIDIEM 03:14

A couple of things from moving from my overheating NetBSD laptop to a Mac Mini (with a 20” BenQ monitor and cheapo keyboard and mouse from MediaMarkt, which are nonetheless fine, may your diety of choice preserve falling prices in consumer electronics). Firstly, I transferred a lot of my music using an external hard disk formatted using FAT 32, since NetBSD wouldn’t recognise UFS as formatted by Mac OS X, despite it theoretically being able to. I used UTF-8 for file names on NetBSD, and on the Mac Mini, as Mac OS X forces you to, but unfortunately FAT 32 doesn’t really have a standard way of specifying “UTF-8 is the file name and directory encoding for this disk, thanks.” So I generated MD5 hash → file name maps for both machines, once the files had been copied, and the renamed them using this information. Here’s the Emacs Lisp:

;; -*- coding: utf-8 -*- 

;; In a traditional Lisp data-is-code approach, for this programlet I
;; generated two lists of MD5 hashes to file name mappings with a shell
;; script:
;
; find . | while read; do echo ""$(openssl md5 < $REPLY)" "$REPLY""; done
; 
;; And then pasted the resulting data between the parentheses in the "data (
;; )" sections below. No explicit file parsing needed. 

(let ((old-file-info #s(hash-table test equal data ( ) ))
      (existing-file-info #s(hash-table test equal data ( ) ))
      new-file-name existing-file-name)
  (maphash
   (lambda (key value)
     (setq existing-file-name value
           new-file-name (gethash key old-file-info))
     (if (not new-file-name)
         (message "no information on file %s" key)
       (unless (file-exists-p new-file-name)
         (unless (file-directory-p (file-name-directory new-file-name))
           (make-directory (file-name-directory new-file-name) t)
         (rename-file existing-file-name new-file-name)))))
   existing-file-info))

Also, Adium doesn’t use Gaim’s log format, so I’ve stuck with the latter as my chat client. Something that surprised me with that was that Option+letter for various atypical letters didn’t work, despite their working fine with XEmacs under X; it turned out I needed to call this:

xmodmap -e 'clear mod1'
xmodmap -e 'add mod5 = Mode_switch'
on starting X11.

I’ve also made a version of the X11 XKB ie layout for OS X available here; despite the layout being based on the Irish Mac layout, there remain some differences, the most notable being the generic Mac weirdness of placement of the @, the § and . Copy the file to /Library/Keyboard layouts and log in again to make it available; feedback and complaints welcome.

Word of the day: der Knüller is German for ‘sensation[al success], a sensational offer;’ often to be had in marketing-speak.

 [No extant comments for this entry.]

Comments are currently disabled.