StringIO: when initialized with empty string use its encoding.

Fixed bug introduced in #2449.