0

I'm trying to troubleshoot this issue in a powershell script, I copy the script from another colleague, found the double quotation marks are garbled code. But this script display normal on other computers.

catch {
        Throw �Failed to uninstall $package�
    }

Does anybody know why? Is it regarding character set? How to fix it?

Thanks in advance.

Jason Yu
  • 183
  • 1
  • 1
  • 5
  • I quess you using Outlook, see: [How should I use Outlook to send code snippets?](https://stackoverflow.com/q/1151152/1701026) – iRon Jun 22 '22 at 05:55
  • If you want to replace this afterwards, see: [Replacing “smart quotes” in powershell](https://stackoverflow.com/a/6968810/1701026) – iRon Jun 22 '22 at 07:12

1 Answers1

0

It's probably text encoding, easiest solution would be to let your colleague save the script in notepad ++ and check that encoding is the same on both PCs enter image description here

FatalxE
  • 31
  • 3
  • But you probably still want to get rid of any smart quotes: `Search` ⭢ `Replace...` – iRon Jun 22 '22 at 08:43
  • Thank you Michal! Actually the script is from Chocolatey which is a package management tool like Homebrew on Mac OS. This problem is causing some users can install software from Chocolatey successful but some users cannot. So I want to know why the quotes can display success on some computers but not on others. – Jason Yu Jun 22 '22 at 09:44