fix #135: apply UTF-8 decoding before parsing
Simplify theory loading code.

This was triggered by #135, as I thought the bug would lie in the theory
loading code. It turned out that it was just some UTF-8 decoding that was
missing. The theory loading code is nevertheless much more readable now.