Enable full Encodings on Windows Console by Default (dotnet/corefx#14649)
* Enable full Encodings on Windows Console by Default by default .NetCore doesn't enable the codepage encoding and the app has to opt-in to the full encoding through the call Encoding.RegisterProvider(CodePagesEncodingProvider.Instance) This was not a good stand for the Console specially on Windows as the Console always using encoding which is not supported by default and we had to fallback using UTF8. In this change we are supporting the full OS encoding on Console and System.Diagnostics.Process without bringing the big encoding size cost (which is 600+ KB). The way we support it is we create an OSEncoding class wrapper which will call the OS instead of using our own encoding data. The only restriction we’ll have is cannot use encoding fallback with OSEncoding as this will be very slow and not intuitive. But this is acceptable as usually apps don’t use the console encodings for such fallback operation. But if anyone want to do that can still register the encoding provider and get full support. * Add Encoder/Decoder to OSEncoding in Console * fix misspelling * Some fixes and adding tests * Fix corner case when buffer has only one high surrogate char Commit migrated from https://github.com/dotnet/corefx/commit/bb068f3be887ed34e7f8bedc4c12ec4284884441
Showing
想要评论请 注册 或 登录