CMake/Source/cm_utf8.h
Brad King e4beefeb6d CTest: Do not munge UTF-8 output in XML files
CTest filters the output from tools and tests to ensure that the XML
build/test result documents it generates have valid characters.
Previously we just converted all non-ASCII bytes into XML-escaped
Unicode characters of the corresponding index.  This does not preserve
tool output encoded in UTF-8.

We now assume UTF-8 output from tools and implement decoding as
specified in RFC 3629.  Valid characters are preserved, possibly with
XML escaping.  Invalid byte sequences and characters are converted to
human-readable hex values with distinguishing tags.  See issue #10003.
2009-12-08 15:43:55 -05:00

30 lines
1.0 KiB
C

/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cm_utf8_h
#define cm_utf8_h
#ifdef __cplusplus
extern "C" {
#endif
/** Decode one UTF-8 character from the input byte range. On success,
stores the unicode character number in *pc and returns the first
position not extracted. On failure, returns 0. */
const char* cm_utf8_decode_character(const char* first, const char* last,
unsigned int* pc);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif