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
This adjusts the Windows console to switch the codepage to UTF-8. This
is important as the default codepage (CP437) does not allow for UTF-8
output, but expects ASCII. However, strings in Swift are assumed to be
UTF-8, which means that there is now a conversion mismatch.
Because the console mode persists beyond the duration of the application
as it is state local to the console and not the C runtime, we should
restore the state of the console before termination. We do this by
registering a termination handler via `atexit`. This means that an
abnormal termination (e.g. via `fatalError`) will irrevocably alter the
state of the console (interestingly enough, `chcp` will still report the
original console codepage even though the console will internally be set
to UTF-8).
Fixes: SR-13807
0 commit comments