Chris Patten in Shanghai

On Tuesday night me and two coworkers (a Brit/South African and a Hong Kongese) went to the renovated Glamour Bar to see Chris Patten give a talk. The new Glamour Bar was quite nice, it moved down below M on the Bund (used to be above it) and has a nice layout for a happy hour type of gathering. Lord Patten came on to the stage around 6:15 and started with a few words about Shanghai, about the M restaurants as well as some other quips that I don’t really remember (but they had me and the crowd laughing).

The name of the event was “The Wisdom and Wit of Chris Patten” and he then started in to the wisdom bit with five points that I assumed came from his most recent book. The basic jist of what he said was how America had backed away from the rules based global leadership that it had exhibited in the last 50 years of the 20th century and how the rise of India and China dictated and necessitated a return to a lot of the globalist policies that America and Europe had once embraced. One of the other main points he made was that Europe needed to stop its xenophobic move regarding Eastern Europe as well as EU expansion.

Unfortunately I can’t really recall everything that he said but I came away with a few impressions. He’s very pro-business and lassize-faire (how can you not be when you had been the last Governor of Hong Kong?). The manner in which he spoke had that aura of an 1970s glamourous British diplomat: every word measured and timed; what was spoken and moreso what was unspoken gave the true meaning of his speech. He was quite captivating to listen to and his speech exuded education and experience far beyond what I’ve seen from American politicians.

During the question & answer period there were a lot of good and probing questions asked including one by some idiot American that rambled in an English that was worse than a lady from Zimbabwe who’d asked another question. However, the last question that was asked was what he sees in Hong Kong’s future. He answered that it was inevitable that democracy would soon arrive and it was the only place in the world where a free nation (e.g. the rule of law existed, open business practices, an uncorrupted police force, etc) exists without a democratic process. The China Daily has an article about his visit to Shanghai and briefly mentions his talk at Glamour Bar.

After the talk, I got a copy of a friend’s book signed and then went to M on the Bund for dinner. M has now firmly placed itself as my favorite restaurant in Shanghai. I’ve been twice and it’s been consistently great. About half way through our meal Lord Patten ended up sitting at the table beside ours, so we got to watch the spectacle of his entourage and some very obvious sycophants. It was quite amusing to, since he started alone and sat as his table reading his Economist and after his quiet time was up about 12 people decended on his table to join him for dinner.

Hip-Hop Lives in Shanghai with DJ Jazzy Jeff

Generally there is a sad lack of hip-hop in Shanghai. Staples like Guandi or Windows are always there but it’s often the same music night after night (esp at Windows). I was surprised — nay, shocked — to see that DJ Jazzy Jeff was going to be in Shanghai at Bonbon last night. I made it to Bonbon about half an hour before he came on. The crowd was pretty interesting, probably half of them were foreigners and the other half locals.

The set was fantastic: it started with some songs I’d never heard before that had more of a D&B beat and then moved on to more typical club songs that were mixed incredibly well. The crowd was really in to it and everybody’s head was bobbing to the tracks. Rumor has it that Naughty by Nature is also going to be in Shanghai in the next few days or weeks, so if this pace can be kept up, there’s hope yet for hip-hop here.

Globalization of Windows Live Mail

Back in the day I worked on among other things the globalization support for Kahuna/Windows Live Mail. The current Hotmail product had limited support for globalized email and so we took this opportunity to enhance how our product would work in terms of sending and receiving email in various languages and markets. I wanted to share some of the scenarios and rules that we use under the hood in order to make Windows Live Mail work well in the global email arena.

On the sending side, the easiest solution would have been to send everything as UTF8 and call it a day. But that’s cheating. For starters, there are a lot of mail clients that exist in many countries that don’t support UTF8 encoding. Further, many national standards bodies request that mails sent in certain languages be sent in certain national character (GB18030 is a good example) sets and transfer encodings. Here are some of the rules we use when we generate mail that get sent to the internet.

  1. Detect the user’s UI settings and country settings first
  2. Auto detect against the entire From, Subject, and Body of the message
  3. If one language is detected, then the native charset is the default charset for the outbound email. Thus we send email in native charset to be compatible with other email services.
  4. If multiple languages related to multiple charsets are detected (e.g. English, French and Japanese), then the outbound mail needs to be encoded with UTF8
  5. If the From, Subject or Body are too short, detection may fail guess incorrectly so it’s possible the wrong outbound encoding may be used

On the receiving side, mail clients have absolutely no idea what the kind of mail that it receives are: what the character encoding is, what the transfer encoding is, even if it’s in proper RFC format. Thus, to properly display globalized data, we have a lot of rules about to make our best effort at decoding a message.

  1. If the message comes with complete MIME charset info convert this inbound email from the charset to UTF8 for display
  2. While reading a message, if the header is RFC2047 encoded but with no body charset info, we apply the header charset to the body without running autodetection. The case the charsets of the head and body are different is not common.
  3. While reading a message, if header is not RFC2047 encoded but body is correctly tagged, we can apply the body charset to the header without running autodetection
  4. While reading a message, if the body contains 8 bit characters ignore any US-ASCII tagging
  5. If the header is not RFC2047 encoded correctly, we apply the user default charset based on the user’s language and country since in the detecting the header may be too expensive. Remember, we’re talking about millions of transactions per second here.
  6. If there is no MIME charset tag or unknown MIME charset or charset is US-ASCII and the message contains 8-bit characters, then the encoding selector should be shown up to allow user to select new encoding in read message page and preview pane page. After a user selects his encoding, then Windows Live Mail will re-load the message based on the user’s selection and convert it to UTF8 for display.
  7. In all cases of ambiguity, show the character selection drop down

There’s a lot of complexity here but we’re quite happy with the way it works. I can read and write emails in multiple languages, which is a huge improvment over Hotmail.

Where I’ve Been

My blog has been devoid of posts for some time primarly since RedYawning was down for nearly a month. I was in the states two weeks ago and got around to fixing it. Turns out that during a reboot the RAID mirror became inconsistent thus it refused to boot, waiting for me to say “okay” to have it rebuild the array. Lame.

Things are going swimmingly in this half the world. I was in San Francisco for two weeks in the end of June and now back in Shanghai. A typhoon missed the city last night which means it’s been blue skys for a total of a day (a personal best). Work continues as usual but a bit busier now with some of the stuff we did in the states now moving out here. Outside of that, nothing much else going out.

Travel plans for the rest of the year are starting to firm up and it looks like I’ll be heading to India in October which means I have to start applying for a visa. Hopefully I can apply for an OCI but it’s unclear if it’s possible to apply in China and the consulate has yet to return my calls.

Finding an Urban Oasis: Fuxing Xi lu

In the hustle and bustle of Shanghai it’s often hard to find any peace and quiet on the street let alone an avenue that’s enjoyable to take a walk on. I stumbled on to an incredible urban oasis on Sunday. I tried out a new yoga studio at Fuxiing Xi Lu and Huashan Lu. The studio is in a beautiful 1930s building that houses a few small boutiques, a cafe and the yoga studio. After the class, I walked along Fuxing Xi Lu until it became Fuxing Zhong Lu.

The street is lined with trees on both sides that arch together to nearly form a canopy across the center and there are all kinds of boutique shops like Madam Mao’s Dowry and Ginger, a cafe. Interestingly enough, some of the stores had full gardens behind them which was wholly shocking. I’d highly recomend starting at Huashan Lu and walking down for half and hour or so until the roar of the traffic reminds you that you’re in Shanghai.