refactor resolve_mbs; improve test cases

make unicode decoding more internal, but externally exposed and documented
through the encoding parameter. further improving pexpect test cases.