locked
Formatting the Output of a Custom Build Step in UNICODE. RRS feed

  • Question

  • How do you output text from a custom build tool so that it correctly displays unicode characters in the Visual Studio output window? This question is partially answered here:

    https://msdn.microsoft.com/en-us/library/yxkt8b26.aspx

    Unfortunately, no information is given on how to deal with unicode text, eg when a filename contains unicode characters.

    I have tried sending output as UTF-8 as well as UTF-16, both with and without BOM, but nothing seems to make Visual Studio interpret the output as unicode.

    Thursday, September 17, 2015 1:43 PM

All replies

  • Hi B Erasmus,

    I suggest you read unicode data to string object and output the string object to output window.

    string message = Encoding.Unicode.GetString(UnicodeBytesArr);
    //output message to output window
    Best Regards,
    Li Wang

    Tuesday, September 22, 2015 9:04 AM
  • Hi Li Wang,

    Thanks for your message but unfortunately it does not answer the question. Sending Unicode to the console is not the problem - the problem is getting Visual Studio to interpret the redirected output as Unicode.

    I have since learnt that Microsoft's own tools (eg cl.exe and link.exe) use a "secret" named pipe to communicate with Visual Studio. This is controlled by an environment variable called VS_UNICODE_OUTPUT. Sadly the details of how this all work is not documented.


    • Edited by B Erasmus Tuesday, September 22, 2015 2:18 PM Typo
    Tuesday, September 22, 2015 2:04 PM