Introducing 莎士比亚.org - Readable Shakespeare Plays In Chinese

I'm very pleased to announce the launch of 莎士比亚.org - beautiful and readable copies of Shakespeare plays in Chinese.

If you would like to help, the text is available on GitHub for people to correct.
Chinese Shakespeare

Why?

I've long held a fascination with Shakespeare - hence the name of this website. At university I studied Mandarin as my minor degree. I was a clumsy student, but enjoyed the regularity and poetry of the language.

I discovered the Chinese writer Zhu Shenghao had translated many of Shakespeare's plays before his untimely death in 1944. I couldn't find any comprehensive collection online, so I gathered together what I could find and reformatted it in what I consider to be a beautiful format.

According to Chinese copyright law the rights expire fifty years after the author's death.

How?

I am indebted to Ben Griffiths's code "The Play's The Thing" which marks up Shakespeare's plays in XML, then uses Ruby to create a static site.

So, I've learned how to use PHP's domDocument to manipulate atrociously formatted HTML, discovered more than I ever wanted to know about different methods of encoding Chinese characters (UTF-8, GB2312, big5, etc) and how to convert between them, got my head around Ruby to parse XML and spit out HTML, and a whole bunch about font subsetting in order to reduce the size of the webfonts.

On the issue of fonts, I've chosen four different fonts - each for different heading or body texts. The fonts used for the titles range from 20KB-360KB. The main body font is 3.2MB. That's probably far too large. They're subsetted down to the the bare minimum number of characters needed, but I'll have to find a way to improve on that.

I showed the pages off to a couple of native Chinese speakers and they confirmed that the fonts were legible.

Romeo Juliet Chinese

Why not .中国?

I had originally registered an International Domain Name ending in .中国 - sadly, the Chinese Registry rejected the name. According to the Chinese Trademark Registry there are a dozen companies who have registered "Shakespeare" as a trademark. And, unless I was prepared to pay over $500 for a trademark I was out of luck.

Hmph.

Help?

I'm sure that the translations aren't necessarily formatted in the correct way. There are also likely to be plays missing. My design ambitions exceed my skills.

If you would like to help improve this service, please pop along to the GitHub repository. There, you will be able to leave a report if something is wrong or even make the changes yourself.

Or, drop a note in the comment box below!

Text Adventures Via Text Message

Remember text adventures, eh? They were pretty nifty!

"You are in a maze of twisty little passages, all alike"
>Go East
"You have been eaten by a Grue. A dwarf starts singing about gold"

Smashing! Just like the pictures are better on the radio, so the graphics are immeasurably superior when they're in your head. Don't get me wrong, I love the 5.1 surround sound snarl of a rabid beast rendered in 1080p - but nothing is quite as good as using your imagination.

Text Adventures - or, more properly, Interactive Fiction - is enjoying a mini-renaissance at the moment. There are emulators for smart phones, computers, and consoles.

But for SMS? None that I could find. Think about it; SMS is close to the perfect medium for Interactive Fiction. Your commands are concise enough to fit into a single message, you don't have to worry about the speed of your response, everything is text based.

So, I present to you, Zork via SMS (with a little help from Twilio).

Twilio Zork SMS

Brilliant!

HOWTO

Although superficially a simple project, there are a few gotchas along the way. This documentation is mostly for me - but may be of use to you :-)

Let's start at the end.... Using Twilio you can send an SMS to a phone number, that is then POSTed to a webserver of your choice.

Twilio will send an SMS back if it receives a response such as

< ?xml version="1.0" encoding="UTF-8"?>
  1. <response>
  2.   <sms>You are in an open field west of a big white house with a boarded
  3. front door.
  4. There is a small mailbox here.
  5. </sms>
  6. </response>

Easy enough. (NB the free account prepends your messages with a trial message. Once you pay, that goes away.)

So, how do we get a text adventure like Zork running server side? There are plenty of client side emulators out there - but I only found one which was purely server side.

THCnet have a PHP interpreter for Zork. It's slightly cludgy - but it works. I'm checking to see if I can distribute it on GitHub.

The game library "dtextc.dat" must be installed in "/usr/games/lib/". The source code is available if you want to recompile it and place it somewhere more accessible.

A MySQL database needs to be created to keep track of users and sessions.

A temporary directory (which must be readable and writeable) will also be needed to store the state of play for each session. I've used "tmp/404/" but you can alter config.php to point wherever is convenient. You will also need to adjust index.php and functions.php with the new location.

Finally, the executable "zork" must be runable.

That's pretty much it.

When a user (or, in this case, Twilio) first makes a request to the URL, we check to see if they already have a session cookie.
If they don't, create one, and start the game by returning the opening text.

For every subsequent connection, we check the state of the game based on their cookie, then apply the body of their SMS to the game engine. Whatever Zork spits out, we return as an SMS.

By default, Twilio kills unused sessions after 4 hours, and all cookies will be lost.

Where Next?

It strikes me that the various forms of text adventures are excellent as a sort of mini-IVR. A nice little finite-state-machine which can quite happily run for years. Services like Frontline SMS are great for information sharing, but they're really not designed for this sort of work.

Could we use interactive fiction in places where SMS is cheap but other forms of entertainment are expensive? Could IF be used to augment existing media events? SMS is lowest common denominator - even iPhones can use it.

But, for now, all I have to worry about is someone texting me "Go west'); DROP TABLE ..." ;-)

A QR Specification For Mobile Payments

BitCoin and other crypto-currencies are gaining popularity at the moment - but I remain firmly convinced that they're too hard for the average person to use. I have, however, watched with interest as an ecosystem grows around them.

In particular, I like the way The Pirate Bay (and others) have used QR codes to facilitate easy payments and donations.
PirateBay BitCoin QR-fs8
The QR codes contain only three variables - the payment method (BitCoin), the destination, and a message. As this is a donation there is no value set. There is a full specification for a BitCoin URI scheme which I think is fairly well designed.

I envisage a day when, on asking for the bill at a restaurant, I am presented with a paper slip totting up my purchases with a neat QR code printed at the bottom. Scanning the code will pull up my banking or credit card app and allow me to make a payment. A verifiable receipt is either shown on screen or sent directly to the restaurant.

For example:
QR Payment

PAY:
 WHO:Pizza Palace
 IBAN:GB29NWBK60161331926819
 CUR:EUR
 VAL:27.35
 REF:123456qwerty
 TIME:1370886496

That's enough human readable information - and machine data - to ensure the correct payment gets from one person to another. I'm sure there are some other fields which may be advantageous to add; tax rate, specific location, etc. But it certainly all fit within a QR code.

QR codes can easily be printed out using the current infrastructure of mobile POS terminals. Those terminals already have mobile network access so can be alerted in real-time when the payment is made. IBAN means we have an easy(ish) way to uniquely identify payment destinations. And, in the UK at least, we have a fairly rapid payments infrastructure.

What's needed is a simple standard and mobile banking and credit card apps to support it.

Simple...

No One Must Know This Is A Sponsored Post - Part 2

Earlier this year, I pointed out that Media Discovery (New Web Ltd) is encouraging blogs to run paid for advertorials, without disclosing to their readership that the content is an advert. This appeared to be in breach of the advertising industry's code of practice.

I complained to the Advertising Standards Authority who have confirmed that they are looking into this company and their business practices.

New Web ASA Complaint

I'll let you know if anything comes of it.