Fix input stream encoding