I have this PowerShell script:
Import-Module ActiveDirectory
Get-ADUser -filter 'SN -eq "Buyl"' -Properties UserPrincipalName,EmployeeNumber,Description,Department,GivenName,sn |
select @{N='UPN';E={$_.UserPrincipalName}},@{N='POINTER';E={$_.EmployeeNumber}},@{N='DESCRIPTION';E={$_.Description}},@{N='DEPARTMENT';E={$_.Department}},@{N='LASTNAME';E={$_.GivenName}},@{N='FIRSTNAME';E={$_.sn}},@{N='OU';E={$ou}} |
ConvertTo-Json
This works fine in PowerShell with users like Anaïs in their first name. I run this script from a PHP script that parses the Json output using json_decode. It seems the special characters break this function.
How can I make sure the PowerShell sends the output in clean UTF8 format that can be parsed with PHP?