The more I look at this one, the more I think I got lucky with unit tests.
I should leave the original part as-is and change the ironpython to something like this:

if sys.platform == 'cli:
    if sys.version_info[0] >= 3:
        return s.encode('utf-8')
    else:
        # just repackage as bytes
        return bytes(s, 'iso-8859-1')