comparison base/StringBits.h @ 1851:91056142abd0

Add function (cribbed from Rosegarden source) to check whether a string is valid UTF-8
author Chris Cannam
date Thu, 30 Apr 2020 14:45:24 +0100
parents 21c792334c2e
children bde22957545e
comparison
equal deleted inserted replaced
1850:e830b252267e 1851:91056142abd0
63 * existing double-quotes within it by a pair of double-quotes, as 63 * existing double-quotes within it by a pair of double-quotes, as
64 * specified in RFC 4180 Common Format and MIME Type for 64 * specified in RFC 4180 Common Format and MIME Type for
65 * Comma-Separated Values (CSV) Files. 65 * Comma-Separated Values (CSV) Files.
66 */ 66 */
67 static QString joinDelimited(QVector<QString> row, QString delimiter); 67 static QString joinDelimited(QVector<QString> row, QString delimiter);
68
69 /**
70 * Return true if the given byte array contains a valid UTF-8
71 * sequence, false if not. If isTruncated is true, the byte array
72 * will be treated as the prefix of a longer byte sequence, and
73 * any errors resulting from a multibyte code ending prematurely
74 * at the end of the array will be ignored.
75 */
76 static bool isValidUtf8(const std::string &bytes, bool isTruncated);
68 }; 77 };
69 78
70 #endif 79 #endif