Search:      
Home | Products & Projects | Downloads | FAQs | News Archive | Feedback | Forums | Site Map | Search | The Fool  

Fun Scripts and Programs

PinyinToUnicode.php

Language: PHP
Platform: Unix, Linux, BSD, Mac OS X, Windows or any OS with PHP installed.
Requirements: PHP module installed into Apache
Cost: Freeware; Open Source
Size: About 1KB

Many students and instructors of the Chinese language have a need to display pinyin with tone marks in their documents. A number of fonts have been created for PC and Macintosh which allow the easy input of pinyin (for example, Easytone by James Dew). I developed a Macintosh application to convert documents between many of these fonts called Pinyin Font Converter. With the growth of Unicode's popularity and the ease with which users can now display unicode, especially in their browsers, many of us want to produce pinyin with tones in unicode.
This page performs a simple function. It converts text written in pinyin, with syllable-final tone numbers, into unicode. The result is displayed both as plain unicode text and as the HTML code necessary to display the unicode in a web page. Simply enter or paste in the pinyin and convert.

Installation: Download the script. The script contains a function which does the conversion. Below this is some code used by my site to output the results, you will need to customize this according to your own needs.

Download

 

Template.pl

Language: Perl
Platform: Unix, Linux, BSD, Mac OS X or any OS with Perl installed.
Requirements: Command line interface
Cost: Freeware; Open Source
Size: About 1KB

With scripting languages such as PHP, ASP, JSP, ColdFusion, etc. it is easy to create web page templates. You have a header file, the web page itself, and a footer file. You put the three together and build your site. Later, when you want to change the header/footer on every page of your site, you simply change one file. You can do this with JavaScript too, which allows you to use simple HTML files for your pages. JavaScript calls the header file as an external script (for example header.js). You simply wrap a header html file with print.document(""). I wrote this really simple perl script to wrap a header.html and footer.html files in this JavaScript statement for easy conversion between an HTML and a JavaScript header.

Installation: Download the script. Change the name from template.txt to template.pl (at the command line this might be mv template.txt template.pl).

Usage: Put the header.html and footer.html files (or one or the other) into the same directory as the template.pl file. Run the template.pl script from the command line and a header.js and footer.js files will be created. To run the script, you may have to add the execute permission (for example chmod +x template.pl) and indicate the script as being in the current directory (for example ./template.pl). This script has only been tested on Linux and Mac OS X.

Download

  Software, web design, and other foolishness by Konrad Mitchell Lawson.
Updated: July 24, 2002
Send Email