Japanese Characters are not recognized when using Invoke-SqlCmd -Query

I'm inserting data from a json file to an SQL server table using Invoke-SqlCmd and using a stored procedure as following:

Invoke-SqlCmd -ServerInstance $servername -Database $database -Query "EXEC dbo.InsertDataFromJson @JSON='$json'

The json is obtained by getting it's raw content:

$json = Get-Content -Path "path\to.json" -Raw

The problem is my json contains Japanese characters and they appear as ???? in the table.

When I try to insert a sample using SSMS directly it works fine.

Do you have any idea how to fix this ?

Thank you



Read more here: https://stackoverflow.com/questions/67169237/japanese-characters-are-not-recognized-when-using-invoke-sqlcmd-query

Content Attribution

This content was originally published by riwik at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: