[cmake-developers] [PATCH v4 4/4] For Windows encode process output to internally used encoding

Brad King brad.king at kitware.com
Mon Jul 18 10:04:31 EDT 2016


On 07/07/2016 05:54 PM, Dāvis Mosāns wrote:
> Typically Windows applications (eg. MSVC compiler) use current console's
> codepage for output to pipes so we need to encode that to internally used
> encoding (KWSYS_ENCODING_DEFAULT_CODEPAGE).
[snip]
>    while ((p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
> +    cmsysProcess_DecodeTextOutput(cp, &data, &length);
[snip]
>    while ((p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
> +    cmsysProcess_DecodeTextOutput(cp, &data, &length);

Unfortunately I don't think that pattern will work reliably because
a multi-byte character could be split across a buffering boundary
and therefore not decoded correctly.  We may need the consuming
contexts to collect the whole output before converting.

Also, I'd like to avoid modifying KWSys Process for this if possible
because it may be replaced by libuv so we need the conversion code
to be in CMake proper.

Thanks,
-Brad



More information about the cmake-developers mailing list