powershell
powershell copied to clipboard
[BUG] New-PnpTerm is changing ASCII ampersand (& - 38) to Unicode ampersand (& - 65286)
Reporting an Issue or Missing Feature
New-PnpTerm is changing an ampersand (&) to a Unicode character.
[NOTE: Unsure whether New-PnpTerm is doing this or SharePoint...]
Expected behavior
The term I create should have exactly the same characters and encoding as I have given it
Actual behavior
When the term I create has an ampersand in it, it is being converted to a Unicode "full width ampersand" &
Steps to reproduce behavior
Assume there is a TermGroup named "Test Group" and a TermSet named "Test Set"
# Set a variable to the string with a plain ASCII ampersand
$newTerm = "First & Second"
# Convert the 6th character (the ampersand) to display its int value
[char[]]$newTerm.substring(6,1) | %{ "$_ -> " + [int]$_ }
& -> 38
# Create the term
$term = New-PnpTerm -TermSet "Test Set" -TermGroup "Test Group" -Name $newTerm
# Display the original term and the returned term - ampersand is a "full width" Unicode ampersand - note the slight difference in the second one
$newTerm, $term.Name
First & Second
First & Second
# Convert the 6th character of the term returned from New-PnpTerm to display its int value
[char[]]$term.Name.substring(6,1) | %{ "$_ -> " + [int]$_ }
& -> 65286
# The value for the 6th character has changed from 38 (ASCII &) to 65286 (Unicode full width ampersand)
What is the version of the Cmdlet module you are running?
1.11.11
Which operating system/environment are you running PnP PowerShell on?
- [X] Windows
- [ ] Linux
- [ ] MacOS
- [ ] Azure Cloud Shell
- [ ] Azure Functions
- [ ] Other : please specify