Set-Content removes copyright symbol This topic contains 2 replies, has 2 voices, and was last updated by David Stiff 2 years, 2 months ago. Author Posts July 14, 2015 at 11:33 am #27509 David StiffParticipant Hello, I am writing a search-and-replace function. The essentials are: $encoding = Get-FileEncoding $filename $text = Get-Content -Path $filename -Raw $text -replace $searchText, $replaceText | Set-Content -Path $filename -Encoding $encoding The code is working but a copyright symbol ©, ASCII 184, is being replaced by a question mark. Any ideas on this? Thanks, Dave July 14, 2015 at 1:41 pm #27515 Max KozlovParticipant which Encoding you get in $encoding ? if this function correct, try to use Get-Content -Encoding $encoding you also can try to save your file in unicode to make sure that copyright still inside. btw in arial font (C) sign code is A9 (169) July 21, 2015 at 12:20 pm #27742 David StiffParticipant Hi Max, sorry for the late reply. Using Unicode does preserve the copyright symbol. Default preserves it as well and doesn't change the file encoding so I will use that. Previously the Get-FileEncoding was returning ASCII (which it defaults to if it cannot match any other format). Thanks, Dave Author Posts You must be logged in to reply to this topic.