Unicode in powershell

I use this script

$old1 = 'Description'
$new1 = 'PLOT'
$old2 = 'Fantastic'
$new2 = 'Brilliant'

$config1s = Get-ChildItem


get-childitem C:\Users\user\Desktop\Powershell -recurse -include *.nfo | 
 select -expand fullname |
  foreach {
            (Get-Content $_) -replace $old1,$new1 | 
             Set-Content $_
            }


get-childitem C:\Users\user\Desktop\Powershell -recurse -include *.nfo | 
 select -expand fullname |
  foreach {
            (Get-Content $_) -replace $old2,$new2 | 
             Set-Content $_
            }

To replace the word Description with plot and the word Fantastic to Brilliant.

however i need to insert Unicode ═ after the words afterwards.. I've read through some other questions and it worked with inserting TM but cant get it to work with this icon.

Icon = http://www.codetable.net/decimal/9552

Can anyone help?

Upvotes: 0

Views: 393

Answers (1)

Theo
Theo

Reputation: 61028

Does inserting [char]9552 not work?
Also, Set-Content has an Encoding option. In order to get a unicode character in a text file you must ensure the file is using the proper encoding for it. Try using Set-Content $_ -Encoding UTF8.
Since your code overwrites the files I would also suggest adding the -Force option to the Set-Content command.

Upvotes: 1

Related Questions