2 * Copyright (C) 2013-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
18 plainAscii
= -1, // only US-ASCII characters (valid for UTF-8 too)
19 hiAscii
= 0, // non-UTF-8 sequence with high ASCII characters
20 // (possible single-byte national encoding like WINDOWS-1251, multi-byte encoding like UTF-32 or invalid UTF-8)
21 utf8string
= 1 // valid UTF-8 sequences, but not US-ASCII only
25 * Check given string for valid UTF-8 sequences
26 * @param str string to check
27 * @return result of check, "plainAscii" for empty string
29 static utf8CheckResult
checkStrForUtf8(const std::string
& str
);
31 static inline bool isValidUtf8(const std::string
& str
)
33 return checkStrForUtf8(str
) != hiAscii
;
36 static size_t FindValidUtf8Char(const std::string
& str
, const size_t startPos
= 0);
37 static size_t RFindValidUtf8Char(const std::string
& str
, const size_t startPos
);
39 static size_t SizeOfUtf8Char(const std::string
& str
, const size_t charStart
= 0);
41 static size_t SizeOfUtf8Char(const char* const str
);