Skip to content

Bug with French accents #61

Description

@PCaron007

Hello,

When I'm using your script with a local .xml
.\Remediate-ToastNotification.ps1 -config .\config-toast-pendingreboot.xml
French accents are shown properly.

When I'm using your script with a .xml URL, accents gets broken and are not shown properly.
Example : .\Remediate-ToastNotification.ps1 -config https://url.toconfig.com/config-toast-pendingreboot.xml
The local version uses -Encoding UTF8 (line 512), but Invoke-RestMethod for the online version has no encoding specified, which causes issues with accented characters.
The fix: force UTF-8 encoding when downloading online. The best approach is to use Invoke-WebRequest and read the content with the correct encoding.

To fix the Issue i had to do a little modification to the script.
Lines 495 and 496
$Response = Invoke-WebRequest -Uri $ConfigPath -UseBasicParsing
$ConfigContent = [System.Text.Encoding]::UTF8.GetString($Response.RawContentStream.ToArray())

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions