Added codepage support.

Also changed some diagnostics messages.
This must've slipped my mind; I meant to throw here. Should we just assume codepage works and let the client pre-emptively check?