That's what I'm thinking. Raw data to scalar values for decode, vice versa for encode, and connect them for transcode, or attempted transcode.
Maybe include some queries for if the mapping is known to be a pure transcoding.
And with some ability to do fast path shortcuts for some pairs of encodings.
This is the normal implementation, so it shouldn't be controversial. I also want to have hooks or capability for transliteration, which is really just more interesting error handling on the "to" side of charset mapping.
Because this may be runtime determined, it probably means virtual functions and a base interface, but I think particular encodings can be types, with final functions, so if you are deterministic the compiler will devirtualize.