Question: Im going to search for every occurrence of a character in a .txt file. It is "�" or better known as 0xFFFD.
Well, i get everything to work if i am searching for a normal string, but i don't get to work this special character.
Imagine i have a specific line in a text file referred by $line and the special character im talking about is in it, for example:

```
$line = 'you cann cho�se f�r everyone'

```

Then I have tried to create the following variables:

```
$SearchCharacter1 = "�"
$SearchCharacter2 = $([char]0xFFFD)

```

Then i have used both of them in the following Powershell code using the Select-String command

```
        if($line | Select-String -Pattern $SearchCharacter -SimpleMatch)
        {
            Write-Host "Character involved"
        }else
        {
            Write-Host "Character not involved"
        }

```

I have also tried a simple contains statement like this:

```
        if($line.Contains($SearchCharacter))
        {
            Write-Host "Character involved"
        }else
        {
            Write-Host "Character not involved"
        }

```

Does anyone what todo to get the Code working? What is so special about 0xFFFD? Why does everything work when i use a normal character.
Thanks for your time!

EDIT:
I get the line like this:

```
    foreach ($file in $files){
    $lines = Get-Content $file
    foreach ($line in $lines){
        # Check if the line contains the character we need to change.
        if($line -match $SearchCharacter)
        {
            # And now do sth with $line

```

Answer: 
My suspicion is the file is encoded as utf8nobom, and you're using powershell 5, which won't recognize the encoding automatically. For that you have to specify the encoding:

```
get-content file -encoding utf8 | select-string �

you cann cho�se f�r everyone

```

UTF8 encodes � as "EF BF BD":

```
format-hex file

   Label: /Users/js/file

          Offset Bytes                                           Ascii
                 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
          ------ ----------------------------------------------- -----
0000000000000000 79 6F 75 20 63 61 6E 6E 20 63 68 6F EF BF BD 73 you cann choï¿½s
0000000000000010 65 20 66 EF BF BD 72 20 65 76 65 72 79 6F 6E 65 e fï¿½r everyone
0000000000000020 0A                                              �

```
Can you try this.

```
   if($line -match $SearchCharacter) {
     Write-Host "Character involved"
   }
   else {
     Write-Host "Character not involved"
   }

```