Something I wanted to mention too, here's a wonderful testcase with lots of corner-cases: http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt ~ Jow