Differences From Artifact [2f7c8ff469]:
- File src/file.c — part of check-in [286950208c] at 2012-09-07 07:53:33 on branch unicode-cmdline — Enable unicode commandline and unicode console output for msvc builds. (user: jan.nijtmans size: 30669) [more...]
To Artifact [779dc56b5b]:
- File
src/file.c
— part of check-in
[9cf5056af9]
at
2012-09-17 07:34:00
on branch win95-unicows
— fix [ce73fc2173]
Restore Win9x, using unicows eliminate all #ifdef UNICODE
(user: jan.nijtmans size: 29993) [more...]
| ︙ | ︙ | |||
1123 1124 1125 1126 1127 1128 1129 |
** to a file, -1 is returned and nothing is written
** to the console.
*/
int fossil_utf8_to_console(const char *zUtf8, int nByte, int toStdErr){
#ifdef _WIN32
int nChar;
wchar_t *zUnicode; /* Unicode version of zUtf8 */
| < < < < < | 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 |
** to a file, -1 is returned and nothing is written
** to the console.
*/
int fossil_utf8_to_console(const char *zUtf8, int nByte, int toStdErr){
#ifdef _WIN32
int nChar;
wchar_t *zUnicode; /* Unicode version of zUtf8 */
DWORD dummy;
static int istty[2] = { -1, -1 };
if( istty[toStdErr] == -1 ){
istty[toStdErr] = _isatty(toStdErr + 1) != 0;
}
if( !istty[toStdErr] ){
/* stdout/stderr is not a console. */
|
| ︙ | ︙ | |||
1150 1151 1152 1153 1154 1155 1156 |
}
nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar);
if( nChar==0 ){
free(zUnicode);
return 0;
}
zUnicode[nChar] = '\0';
| < < < < < < < < < < < < < < < < < < < < | 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 |
}
nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar);
if( nChar==0 ){
free(zUnicode);
return 0;
}
zUnicode[nChar] = '\0';
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr), zUnicode, nChar, &dummy, 0);
return nChar;
#else
return -1; /* No-op on unix */
#endif
}
/*
|
| ︙ | ︙ |