Artifact 5329f7273d28b6594978275a98e1a3b6094bb99db1defb509cdfa1ad4570dea8:
- File
src/OFStdIOStream_Win32Console.h
— part of check-in
[3e1b6bccbc]
at
2016-03-12 20:28:31
on branch trunk
— Properly handle UTF-8 in Win32 console
The previous way was to set the codepage to UTF-8, however, this does
not work properly on some versions of Windows.Instead, this catches reads / writes on of_std* on the lowlevel,
interprets it as UTF-8, converts it to / from UTF-16 and then uses
ReadConsoleW() / WriteConsoleW().Surrogates being cut in the middle is not properly handled yet, this
will be implemented in a follow up commit. (user: js, size: 769) [annotate] [blame] [check-ins using]
/* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 * Jonathan Schleifer <js@heap.zone> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #define OF_STDIO_STREAM_WIN32CONSOLE_H #import "OFStdIOStream.h" OF_ASSUME_NONNULL_BEGIN @interface OFStdIOStream_Win32Console: OFStdIOStream { HANDLE _handle; } @end OF_ASSUME_NONNULL_END