Skip to content

Commit dc59ce4

Browse files
committed
Set _fmode to utf8 for Windows builds.
1 parent 8d0a3a4 commit dc59ce4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ BC_USE_LIBBITCOIN_MAIN
3131
*/
3232
int bc::main(int argc, char* argv[])
3333
{
34+
#ifdef _MSC_VER
35+
if (_setmode(_fileno(stdin), _O_U8TEXT) == -1)
36+
throw std::exception("Could not set STDIN to utf8 mode.");
37+
if (_setmode(_fileno(stdout), _O_U8TEXT) == -1)
38+
throw std::exception("Could not set STDOUT to utf8 mode.");
39+
if (_setmode(_fileno(stderr), _O_U8TEXT) == -1)
40+
throw std::exception("Could not set STDERR to utf8 mode.");
41+
#endif
42+
3443
return bc::server::dispatch(argc, const_cast<const char**>(argv),
3544
bc::cin, bc::cout, bc::cerr);
3645
}

0 commit comments

Comments
 (0)