encode input from stdin BEFORE parsing