The encoding length for unicode values was applied to the wrong index variable. Thanks to Paul Guyot for the detailed bug report and fix. Fixes #7