Unicode supplementary character string library for JavaScript

From: Marc Durdin <marc.durdin_at_tavultesoft.com>
Date: Thu, 10 May 2012 22:25:36 +0000

A few weeks ago there was a discussion about JavaScript and UCS-2 on this list, which rekindled a long-standing desire I have had to write a set of functions that handled supplementary pairs in JavaScript strings transparently. I've just published (under MPL1.1) some code that I hope some of you may find interesting or helpful.

This JavaScript library adds analogue functions for each of the straightforward String functions which deal with character indexes, such as charAt or indexOf. It does not attempt to handle regular expressions. The prototype functions are prefixed with "kmw" which I chose both because the library was originally intended for KeymanWeb, and also because it will hopefully be fairly unique and not step on the toes of other libraries. There are few edge cases that are probably incorrectly handled, and no effort has gone into optimization yet.

Version 0.2 of the library can be downloaded from https://github.com/tavultesoft/keyman-tools/tree/master/kmwString and I have a couple of blog posts with more details at http://marc.durdin.net/2012/04/more-utf-32-aware-javascript-string.html and http://marc.durdin.net/2012/05/updates-to-kmwstring-functions.html

Marc Durdin
Received on Thu May 10 2012 - 17:30:15 CDT

This archive was generated by hypermail 2.2.0 : Thu May 10 2012 - 17:30:21 CDT