| 337 | const string EVAL_SQL_EMPTY = "#EMPTY#"; |
| 338 | |
| 339 | void ShellState::Print(PrintOutput output, const char *str, idx_t len) { |
| 340 | if (seenInterrupt) { |
| 341 | // no more printing after seeing an interrupt |
| 342 | return; |
| 343 | } |
| 344 | |
| 345 | #if defined(_WIN32) || defined(WIN32) |
| 346 | if ((stdout_is_console && (out == stdout || out == stderr)) && !pager_is_active) { |
| 347 | // convert from utf8 to utf16 |
| 348 | string data_str = str ? string(str, len) : ""; |
| 349 | auto unicode_text = ShellState::Win32Utf8ToUnicode(data_str); |
| 350 | auto out_handle = GetStdHandle(output == PrintOutput::STDOUT ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE); |
| 351 | // use WriteConsoleW to write the unicode codepoints to the console |
| 352 | WriteConsoleW(out_handle, unicode_text.c_str(), unicode_text.size(), NULL, NULL); |
| 353 | return; |
| 354 | } |
| 355 | #endif |
| 356 | fwrite((const void *)str, len, 1, output == PrintOutput::STDOUT ? out : stderr); |
| 357 | } |
| 358 | |
| 359 | void ShellState::Print(PrintOutput output, const char *str) { |
| 360 | if (seenInterrupt) { |