1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; -*- */ 2 /* ***** BEGIN LICENSE BLOCK ***** 3 * This file is part of openfx-supportext <https://github.com/devernay/openfx-supportext>, 4 * Copyright (C) 2013-2018 INRIA 5 * 6 * openfx-supportext is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * openfx-supportext is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with openfx-supportext. If not, see <http://www.gnu.org/licenses/gpl-2.0.html> 18 * ***** END LICENSE BLOCK ***** */ 19 20 /* 21 * OFX utiliy functions to open a file safely with UTF-8 encoded strings. 22 */ 23 24 #ifndef openfx_supportext_ofxsFileOpen_h 25 #define openfx_supportext_ofxsFileOpen_h 26 27 #include <string> 28 #include <cstdio> 29 30 namespace OFX { 31 32 #ifdef _WIN32 33 std::wstring utf8_to_utf16 (const std::string& utf8str); 34 std::string utf16_to_utf8 (const std::wstring& str); 35 #endif 36 37 std::FILE* fopen_utf8(const char* path, const char* mode); 38 39 } // namespace OFX 40 #endif /* defined(openfx_supportext_ofxsFileOpen_h) */ 41