Overview
Comment: | OFStdIOStream: Set codepage to UTF-8 on Windows |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0a001bfd7b80387beee9396a353fa608 |
User & Date: | js on 2016-02-28 15:31:18 |
Other Links: | manifest | tags |
Context
2016-02-28
| ||
16:08 | OFOptionsParser: Make sure _options is terminated check-in: 1808782994 user: js tags: trunk | |
15:31 | OFStdIOStream: Set codepage to UTF-8 on Windows check-in: 0a001bfd7b user: js tags: trunk | |
2016-02-22
| ||
15:25 | OFDate: Do not use lrint() for microseconds check-in: f1765412c7 user: js tags: trunk | |
Changes
Modified src/OFStdIOStream.m from [03a4b1227f] to [b1b921ad96].
︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | + + + + + + + + + + + + + + + + | #import "OFStdIOStream.h" #import "OFDate.h" #import "OFApplication.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #ifdef OF_WINDOWS # include <windows.h> #endif OFStdIOStream *of_stdin = nil; OFStdIOStream *of_stdout = nil; OFStdIOStream *of_stderr = nil; #ifdef OF_WINDOWS UINT originalConsoleCP; UINT originalConsoleOutputCP; static void restoreCodepage(void) { SetConsoleCP(originalConsoleCP); SetConsoleOutputCP(originalConsoleOutputCP); } #endif @interface OFStdIOStream () - (instancetype)OF_initWithFileDescriptor: (int)fd; @end void of_log(OFConstantString *format, ...) |
︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | + + + + + + + + + + + + | @implementation OFStdIOStream + (void)load { of_stdin = [[OFStdIOStream alloc] OF_initWithFileDescriptor: 0]; of_stdout = [[OFStdIOStream alloc] OF_initWithFileDescriptor: 1]; of_stderr = [[OFStdIOStream alloc] OF_initWithFileDescriptor: 2]; } #ifdef OF_WINDOWS + (void)initialize { originalConsoleCP = GetConsoleCP(); originalConsoleOutputCP = GetConsoleOutputCP(); atexit(restoreCodepage); SetConsoleCP(CP_UTF8); SetConsoleOutputCP(CP_UTF8); } #endif - init { OF_INVALID_INIT_METHOD } - (instancetype)OF_initWithFileDescriptor: (int)fd |
︙ |