link-grammar-5.8.0/link-parser/parser-utilities.c
/**
 * Set the output conversion attributes for transparency.
 * This way UTF-8 output doesn't pass any conversion.
 */
Set the output conversion attributes for transparency.
This way UTF-8 output doesn't pass any conversion.
Set the output conversion attributes for transparency . This way UTF - 8 output doesn ' t pass any conversion .
void win32_set_utf8_output(void)
{
	if (-1 == _setmode(fileno(stdout), _O_BINARY))
	{
		prt_error("Warning: _setmode(fileno(stdout), _O_BINARY): %s.\n",
			strerror(errno));
	}
	console_input_cp = GetConsoleCP();
	console_output_cp = GetConsoleOutputCP();
	atexit(restore_console_cp);
	if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE))
	{
		prt_error("Warning: Cannot not set code page restore handler.\n");
	}
	if (!SetConsoleCP(CP_UTF8))
	{
		prt_error("Warning: Cannot set input codepage %d (error %d).\n",
			CP_UTF8, (int)GetLastError());
	}
	if (!SetConsoleOutputCP(CP_UTF8))
	{
		prt_error("Warning: Cannot set output codepage %d (error %d).\n",
			CP_UTF8, (int)GetLastError());
	}
}
void win32_set_utf8_output ( void ) { if ( -1 == _setmode ( fileno ( stdout ) , _O_BINARY ) ) { prt_error ( " \n " , strerror ( errno ) ) ; } console_input_cp = GetConsoleCP ( ) ; console_output_cp = GetConsoleOutputCP ( ) ; atexit ( restore_console_cp ) ; if ( ! SetConsoleCtrlHandler ( ( PHANDLER_ROUTINE ) CtrlHandler , TRUE ) ) { prt_error ( " \n " ) ; } if ( ! SetConsoleCP ( CP_UTF8 ) ) { prt_error ( " \n " , CP_UTF8 , ( int ) GetLastError ( ) ) ; } if ( ! SetConsoleOutputCP ( CP_UTF8 ) ) { prt_error ( " \n " , CP_UTF8 , ( int ) GetLastError ( ) ) ; } }
Set the output conversion attributes for transparency.
Set the output conversion attributes for transparency .
/* For file output. It is too late for output pipes.
	 * If output pipe is desired, one can set CP_UTF8 by the
	 * command "chcp 65001" before invoking link-parser. */ /* For Console output. */