Invoke-Sqlcmd : Incorrect syntax near '¦'. Encoding issue

Solution 1:

Make sure the script is saved in an encoding powershell 5.1 can recognize (I'm looking at Notepad in Win10 20h2) (ansi is probably the worst choice):

ansi
utf-16 le
utf-16 be
utf-8 with bom

not (unless you're in powershell 7).

utf-8

Notepad can recognize utf-8.

test.ps1:

'æøå'