summaryrefslogtreecommitdiffstats
path: root/win/tclWinError.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWinError.c')
-rw-r--r--win/tclWinError.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/win/tclWinError.c b/win/tclWinError.c
index fea4b0f..18f290f 100644
--- a/win/tclWinError.c
+++ b/win/tclWinError.c
@@ -391,21 +391,24 @@ tclWinDebugPanic(
if (IsDebuggerPresent()) {
WCHAR msgString[TCL_MAX_WARN_LEN];
- char buf[TCL_MAX_WARN_LEN * TCL_UTF_MAX];
+ char buf[TCL_MAX_WARN_LEN * 3];
vsnprintf(buf, sizeof(buf), format, argList);
- msgString[TCL_MAX_WARN_LEN-1] = L'\0';
+ msgString[TCL_MAX_WARN_LEN-1] = '\0';
MultiByteToWideChar(CP_UTF8, 0, buf, -1, msgString, TCL_MAX_WARN_LEN);
/*
* Truncate MessageBox string if it is too long to not overflow the buffer.
*/
- if (msgString[TCL_MAX_WARN_LEN-1] != L'\0') {
+ if (msgString[TCL_MAX_WARN_LEN-1] != '\0') {
memcpy(msgString + (TCL_MAX_WARN_LEN - 5), L" ...", 5 * sizeof(WCHAR));
}
OutputDebugStringW(msgString);
} else {
+ if (!isatty(fileno(stderr))) {
+ fprintf(stderr, "\xef\xbb\xbf");
+ }
vfprintf(stderr, format, argList);
fprintf(stderr, "\n");
fflush(stderr);