MPW Tips & Tricks

Special Characters in Web Pages

The Macintosh Roman character set includes characters like curly quotation marks and em-dashes, which look better than typewriter-style quotes or doubled hyphens (“” vs "", — vs --). But did you know you can use these characters on Web pages as well?

All you have to do is type the appropriate Unicode character codes in the usual HTML “&#...;” syntax. But who can remember these codes, or be bothered to copy and paste them from a table, or anything like that? Wouldn’t it be easier to simply type the usual Macintosh keyboard sequence, and have the appropriate code be immediately inserted into your HTML file?

Yes, you can do this, simply by defining appropriate MPW key bindings. The following commands will do the trick for the opening and closing single and double quotes, the em-dash, and also the non-breaking space:

SetKey 'option-[' "Echo -n '“'" # opening double quote

SetKey 'option-shift-[' "Echo -n '”'" # closing double quote

SetKey 'option-]' "Echo -n '‘'" # opening single quote

SetKey 'option-shift-]' "Echo -n '’'" # closing single quote

SetKey option-shift-dash "Echo -n '—'" # em-dash

SetKey option-space "Echo -n ' '" # non-breaking space

Other characters could be added to this list, but the above are the ones I have found most useful.

But perhaps you don’t want these key bindings to be effective all the time: there are times when you want the normal Macintosh characters to be inserted literally when you press those keys.

Suppose you put the above commands in an MPW Shell script file called DefineWebKeys, which you save in MPW’s Scripts folder: then you can define those bindings simply by entering the DefineWebKeys command. If so, you can remove the bindings by first executing a command like this:

This scans the DefineWebKeys script, looking for the SetKey commands, and turns each one into an UnsetKey command for the same key. You then select these generated UnsetKey commands and press Enter to execute them.

Finding Invisible Preferences Files

The following command

Files -x rbcta `FindFolder pref` | Search -s /[aA]V[bB]/

will find invisible files in your Preferences folder. It does require that a copy of my FindFolder tool be installed. If you don’t want to install this, you could use the following non-localizable version:

Files -x rbcta "{SystemFolder}Preferences:" | Search -s /[aA]V[bB]/

 

Created by LDO 2000 November 26, last modified 2001 August 17.

Back to MPW Intro