ConvertTo-CSV losing accent characters

  • I'm trying to

    ConvertTo-CSV ... | Clip (ie, to Clipboard), so I can paste into Excel and work with my data.

    Working spectacularly in English, but losing accented/special characters in French.

    Any ideas how to make this work without writing to file / opening file in Excel, which is nowhere near fast enough?

  • Which part of the script is losing the accents? Is it the clipboard?

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • At this URL (http://superuser.com/questions/302032/how-to-copy-text-from-powershell) there are the following comments:

    This will not work with Unicode, though. In that case you can use Set-Clipboard from PSCX. – Joey Jun 23 '11 at 8:00

    There IS a way to have clip.exe handle Unicode correctly: set PS's $OutputEncoding variable to BOM-less UTF-16 first, as follows: $OutputEncoding = New-Object System.Text.UnicodeEncoding($false, $false) – mklement0 Mar 22 '13 at 18:57

    That might help.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • This worked a charm: $OutputEncoding = New-Object System.Text.UnicodeEncoding($false, $false)

    Thanks Gary!

  • You're welcome schleep!!!

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply