Fix euc-kr https://www.w3.org/Bugs/Public/show_bug.cgi?id=16691

This increases the size of the index, but gives us a much simpler
decoder/encoder algorithm.

It also fixes an issue with error handling.