Sunday, 27 September 2015

Nottingham on Weibo

Sina Weibo 新浪微博 is a China microblogging service Nottingham now has a number organisations on Sina Weibo. Here are some of them.

  1. Nottingham City Council [@英国诺丁汉市政厅]
  2. Nottingham Trent University [@英国诺丁汉特伦特大学]
  3. University of Nottingham [@英国诺丁汉大学官方微博]

Note: I only list Nottingham Weibo accounts that are verified and have a meaningful URL ie not the default numeric form.

Wednesday, 29 July 2015

JavaScript Variable Names

In I explained how PHP variable names are determined at the byte level. JavaScript variable names are determined at a higher level and are defined in terms of Unicode Properties and General Categories.

Letʼs start with some simple Basic Latin variable name examples.
  • Valid Names:  nottingham  nottingham8
  • Invalid Name:  8nottingham
where 8 is Unicode character U+0038 DIGIT 8. The last name, above, being invalid because it begins with a digit.

We are in the Unicode age and so do not need to restrict ourselves to Basic Latin. Some time ago I asked myself whether the same Basic Latin rule, an initial digit is invalid, applies to other Scripts and yes it does (well mostly).
  • Valid Devanagari Names:  नाटिंघम  नाटिंघम६
  • Invalid Devanagari Name:  ६नाटिंघम
where ६ is Unicode character U+096C DEVANAGARI DIGIT SIX
  • Valid Thai Names:  นอตทิงแฮม  นอตทิงแฮม๘
  • Invalid Thai Name:  ๘นอตทิงแฮม
where ๘ is Unicode character U+0E58 THAI DIGIT EIGHT
  • Valid Telugu Names:   నాటింగ్‌హామ్  నాటింగ్‌హామ్౬
  • Invalid Telugu Name:  ౬నాటింగ్‌హామ్
where ౬ is Unicode character U+0C6C TELUGU DIGIT SIX
  • Valid Chinese Names:  诺丁汉  诺丁汉八  八诺丁汉
where 八 is the digit 8, aka Unicode character U+516B CJK UNIFIED IDEOGRAPH-516B

So, Unicode CJK Ideographs are the exception as a name can begin with a digit. Unicode CJK Ideographs encompass Chinese Hanzi, Japanese Kanji and Korean Hanja. The reason for this exception is because of the Unicode General Category to which these digits are assigned. The digits 8, ६, ๘, ౬ have the General Category Nd which is Decimal Number and thus, cannot be the first character of a variable name. 八 has the General Category Lo which is Other Letter and thus, can be the first character of a variable name even though semantically it is a digit.

The above holds true for ECMAScript 5 and 6 and possibly earlier versions but it is unlikely I will test earlier versions. You can validate your variable names online at

For further reading I suggest:

Friday, 17 July 2015

Multilingual PDF

There is an OS X extension lpdf, which is the Multilingual PDF of the title of this blog article. Letʼs look at System with terminal.

find . -name '*.lpdf'

Looking inside, for example, productinfo1.lpdf/Contents/Resources we can see a set of lproj directories.
ar.lproj es.lproj id.lproj pl.lproj th.lproj ca.lproj es_MX.lproj it.lproj pt.lproj tr.lproj cs.lproj fi.lproj ja.lproj pt_PT.lproj uk.lproj da.lproj fr.lproj ko.lproj ro.lproj vi.lproj de.lproj he.lproj ms.lproj ru.lproj zh_CN.lproj el.lproj hr.lproj nl.lproj sk.lproj zh_TW.lproj en.lproj hu.lproj no.lproj sv.lproj
The above directory names are of the form language tag.lproj. Languages include: ar (arabic), fr (french), ja (japanese), ko (korean), th (thai) and zh_CN (chinese in China). Inside each of the above directories is a language localized productinfo1.pdf e.g. ko.lproj contains a productinfo1.pdf which is the Korean language version of the document.

More concisely: A lpdf is an OS X Package containing a set of language localized PDFs.

Note: This exploration of lpdf was carried out using OS X Yosemite 10.10.4.

Monday, 22 June 2015

PHP Variable Names

For years I thought PHP variable names could only be constructed from ASCII characters. Actually, maybe I had not really thought about it but rather just followed common practice without question. The common practice being something like
  • a variable name is prefixed with $
  • the first character must be a letter (a-z, A-Z) or an underscore (_)
  • subsequent characters can be any mix of letters or digits (0-9) or underscore
So, examples of valid PHP variable names include
  • $Andre   $age   $previous_total
But!!!!! We are in the Unicode age and so variable names are NOT restricted to the above common practice. We can be much more creative. We can, for instance, localise our code. Examples of valid variable names include
  • $André   $小山   $エクセレント   $우수한   $🐉
For the following explanation I am assuming your source code file is saved as Unicode UTF-8. If not, it should be.

Letʼs refer to the the definitive PHP documentation concerning variable names which is at The key is the specified regular expression
  • [a-zA-Z_\x7F-\xFF][a-zA-Z0-9_\x7F-\xFF]*
The variable name 小山 UTF-8 encoded is E5 B0 8F E5 B1 B1 which is matched by above regular expression. The variable name 🐉 UTF-8 encoded is F0 9F 90 89 which is also matched by the above regular expression.

Determination of valid variable names is at a low level, the byte level. A UTF-8 encoded character will consist of 1 to 4 bytes. Only characters in the Basic Latin Unicode block (which is the same as ASCII) use 1 byte for encoding. All other characters require 2 to 4 bytes for encoding. The byte values for these All other characters are always ≥ 80. The consequence is that if one uses non Basic Latin Unicode characters there are no restrictions whatsoever! Thus one can, for example, have Chinese, Japanese, Korean, Punjabi, Russian or Egyptian Hieorglyphs variable names. One can have Currency Symbol, Mathematical Operators or Emoji variable names. An opportunity to be creative.

There are perhaps certain practices one should avoid when using Unicode for your variable names. The below are actually 3 different (valid) variable names even though they appear visually identical.
  • $Аndré (uses U+0410 CYRILLIC CAPITAL LETTER A)
What of the allowed byte value 7F (DELETE)? Why is this allowed in a variable name? I do not have a good answer to this. I also do not have a bad answer. At the moment I am going to leave this pending whilst I conduct further research.

Sunday, 14 June 2015

Chinese Name

My chinese adopted name is 小山 which consists of two chinese characters. Sometime ago I was informed that there is a single chinese character that combines 小 and 山. The ideographic description character sequence is ⿱小山

This combined character is encoded in Unicode in SIP (Supplementary Ideographic Plane), CJK Unified Ideographs Extension C at codepoint U+2AA24. The only font I have, so far, found which contains a glyph for this character is hanazono which is available for download from Hanazono is actually provided as two ttf font files:  HanaMinA and HanaMinB. Here is what the combined character, which is in HanaMinB, looks like in TextEdit on OSX.

Is there a sound for this uncommon character? After much searching I discovered which represents the sound as shān (Hanyu Pinyin) and ㄕㄢ (Zhuyin). Same sound for both forms of representation. CNS 11643 is a Taiwanese character set.

Friday, 12 June 2015


There is a regularly updated ICANN csv file which summarises key New gTLD information in 6 fields. It is available at (ref:

field 1: ASCII form (A-label)
field 2: unicode form (U-label) if an IDN otherwise empty
field 3: registry operator
field 4: date registry agreement signed
field 5: application number
field 6: date of delegation (empty if not yet delegated)

Fields 1,2 (if an IDN),3,4 from this csv are incorporated into the public suffix list

For example, the csv entry for .コム is

xn--tckwe,コム,"VeriSign Sarl",2015-01-15,1-1254-37311,

It seems as though Chrome browser uses this public suffix list. One interesting (and IMHO good) consequence is that Chrome will recognise a .コム IDN (eg ) as a domain name to be resolved even though it is not yet delegated. Chrome does not resort to a search. So Chrome is ready to go as soon as .コム is delegated.

Tuesday, 10 March 2015


Орёл и Решка is a russian language ukrainian TV travel programme. Season 9 episode 14 was all about Nottingham which in russian is Ноттингем. The presenters were Регина Тодоренко and Евгений Синельников. I watched this episode and found it fascinating to see and hear of Nottingham from a different point of view and language.

There is an English wikipedia article about Орёл и Решка

A russian language writeup of the visit to Nottingham/Ноттингем is available on the programme's website

Регина Тодоренко stayed in the Edwards room at Langar Hall Country House Hotel

The London RouteMaster Bus was hired from Blackmore Commercials

Throughout the video there are popups specifying the cost of various items. Interestingly, three different currencies are used - Russian Rubles (РУБ), British Pounds (£), US Dollars ($).

I used a Unicode savvy shortening service to create links to the below video -ноттингем诺丁汉ノッティンガム노팅엄नाटिंघमΝότιγχαμ

Letʼs also have an emojified link ➜ 🍆😁🌊🏂🎳🐤🎉🍣.🆒🔗.ws