While writing up my solution for the Don't quote Me problem, I had a lot of trouble getting a single APL font for that page to display correctly in both Mozilla Firefox and Internet Explorer until I came across the Unicode fonts. I liked that solution so much, I wrote a script which can also be used as an Apache Web Server handler as well as at the command line.
This script converts, on the fly, from APL characters represented in braces (e.g., {domino}) to the corresponding HTML Character Entities (e.g., ⌹ which a Unicode-aware browser then displays as the corresponding APL glyph (e.g., ⌹). Mozilla Firefox is an excellent browser and fully supports APL glyphs in Unicode. The latest version (7.x) of Internet Explorer also handles these glyphs correctly, although version 6.x doesn't.
The script is available in the languages PHP and Perl either of which can be used from the command line to convert a file from APL in Braces to HTML Character Entities, or as an Apache Action Handler.
The advantage of the latter is that you can create a special
extension (say .ahtml
) for your web pages with APL
character names in braces, and then tell the Apache web server to
take a special action (i.e. call one of the above-mentioned scripts)
whenever it encounters a web page with the special extension. The
script then creates the finished HTML and sends it to the end
user.
You can install an Apache Action Handler only if you can read/write
the Apache configuration file (usually named
httpd.conf
).
To use either of these scripts from the command line, call it with the incoming file in Standard Input; the converted file appears in Standard Output. For example,
b2a <index.txt >index.html
To use either of these scripts as an Apache Action Handler, include these lines in the Apache configuration file:
AddType text/html .ahtml AddHandler Braces2APL .ahtml
To use the PHP version, also include this line
Action Braces2APL /cgi-bin/b2a.php
To use the Perl version, instead include this line
Action Braces2APL /cgi-bin/b2a.pl
where /cgi-bin/
is the path to wherever you saved the
file.
Also, upload the relevant files (b2a.php
and
b2a.inc.php
to use the PHP version, and
b2a.pl
and b2a.inc.pl
to use the Perl
version) to the above-named directory.
The scripts may be found in a single zip file.
If you have trouble displaying the APL characters on this page, likely it is due to either a browser setting (or an out-of-date browser) or a missing font. Both Mozilla Firefox 2.0 or later and Internet Explorer 7 or later display the APL characters perfectly, but IE6 has some trouble. If this page doesn't display well with either APL Unicode font using any version of Internet Explorer, please try it again with Mozilla Firefox. Links for the two APL Unicode fonts as well as for Mozilla Firefox appear at the top of this page.
This page was created by Bob Smith -- please any questions or comments about it to me. See my other APL projects.
NARS2000 © 2006-2020 |
|
Comments or suggestions? Send them to . |