Fix stream encoding miss match issue