Fixed unicode support under windows console

This commit is contained in:
2023-05-18 21:33:54 -04:00
parent fd137e8e74
commit eb43c99f47
2 changed files with 4 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
#include "drvutil.hpp"
#include "sslutil.hpp"
#include "readline.hpp"
#include "../core/enginewrapper.hpp"
#include <iostream>
@@ -233,8 +234,8 @@ static void console_write(const CodepointString &cps) {
if (cps.size() == 0) return;
// Convert to wstring.
// Any character outside the range 0xFFFF is replaced with a box.
std::wstring ws(cps.size());
for (int i = 0; i < cps.size(); i++) {
std::wstring ws(cps.size(), 0);
for (int i = 0; i < int(cps.size()); i++) {
char32_t c = cps[i];
if ((c >= 0)&&(c <= 0xFFFF)) ws[i] = (wchar_t)c;
else ws[i] = 0x2610;

View File

@@ -477,7 +477,7 @@ class Driver {
void handle_socket_input_output() {
std::string err;
int mstimeout = read_console_recently_ ? 100 : 1000;
int mstimeout = read_console_recently_ ? 10 : 100;
// Peek output buffers and determine channel release flags.
bool any_released = false;