added a way to force set the character encoding on a stream instead of relying on auto-detection.