You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stateful CJK incremental encoders keep the shift state after a failed encode() #160522
When an incremental encode() call of a stateful CJK codec (iso2022_jp*, iso2022_kr, hz) fails, the output of that call is discarded but the shift state it reached is kept. The next encode() then leaves out the escape sequence, so double-byte characters are written while the stream is still in ASCII mode. IncrementalEncoder.encode() (and so io.TextIOWrapper.write()) and StreamWriter.write() are affected. The encoder already restores its pending buffer on this path, just not the codec state.
Activity