Add encodeUnits() to utf8/utf16/sjis.

So that we know how many units (e.g. u16s) are needed to encode.
Merge pull request #211 from unknownbrackets/ccc

Add encodeUnits() to utf8/utf16/sjis.