utf-8 characters in powershell log

  1. I'm afraid this is PowerShell issue.

    From what I've found there is no way to set encoding for process output redirection:
    https://connect.microsoft.com/PowerShell/feedback/details/738558/se...
    http://stackoverflow.com/questions/22349139/utf8-output-from-powers...

  2. The characters that are showing up appear to be UTF8 bytes encoded using CodePage 437. Specifically the example listed in http://www.appveyor.com/docs/lang/nodejs-iojs can be reproduced with this F#:

    let s = "├──"
    let utf8 = System.Text.Encoding.UTF8
    let ibm437 = System.Text.Encoding.GetEncoding 437
    printfn "%s" (utf8.GetBytes s |> ibm437.GetString)

    Not surprising, that is the default Console.OutputEncoding in PowerShell.

    For completeness, the other code pages that matched the error text were 861 and 865, but I bet it is probably 437.

    If you want to email me how you are launching PowerShell, I can try out fixes for it. I just need a locally reproducible test case.

  3. Sure, AppVeyor implements custom PowerShell host with UI, something like that:
    https://msdn.microsoft.com/en-us/library/ee706570(v=vs.85).aspx

    However, there is a trick when running some external process in that sample - if the process has a handle to the console all output will be redirected right to the console and won't be caught by Write methods. Use Windows forms or WPF app to host your custom PS host to suppress console output.

    If you can solve that puzzle that would be awesome! :)

  4. I put that code in a solution that builds here:
    https://github.com/ctaggart/AppVeyor

    The next steps are to reproduce the issue locally. Help with that in the form of a pull request would be very welcome. I will also try again when I get through a few other higher priority issues. :)

  5. yeah, the host should be not a console app, but windows forms or WPF.

  6. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:55 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac