Restore codec to profile setting or previous codec upon reset.
Previously, after typing in 'reset' or using 'Clear Scrollback & Reset',
the current codec is lost.
With this patch, typing in 'reset' will cause the codec to stay what
it was before the reset. Using the 'Clear Scrollback & Reset' will
cause the codec to be set to the Profile setting.
This may get backported to 4.6.x
(cherry picked from commit 27182ebbadb8bcf406cba74be1888125e54fe63f)