2020年12月20日星期日

Invoke-Webrequest | Invoke-RestMethod - Powershell question marks instead of hebrew

I'm trying to send a post with Invoke-Webrequest / Invoke-restmethod in 2 scenarios. one of them is working well and the other is working but replacing Hebrew letters with question marks...

This one is working well:

json = @{         "contactID"= "my id";      "text" = "היי";  }    Invoke-WebRequest -Uri http://localhost:8880/messages/send/text -Method POST -ContentType 'application/json' -Body $json  

This one is replacing Hebrew chars with question marks:

  $json = @"  {        "contactID" : "$($LastMessage.key.remoteJid)",        "quotedMessage": {            "key": {                "remoteJid": "$($LastMessage.participant)",                 "id": "c"             },            "message": { "conversation": "$($LastMessage.message.conversation)" }         },        "text": "היי"     }  "@  Invoke-WebRequest -Uri http://localhost:8880/messages/send/text -Method POST -ContentType 'application/json' -Body $json  

Any option to use the second one without braking the Hebrew letters? Tried several ways to convert it to UTF8, but it doesn't help at all, just making the question marks with black background behind.

I will appreciate any help.

https://stackoverflow.com/questions/65386356/invoke-webrequest-invoke-restmethod-powershell-question-marks-instead-of-heb December 21, 2020 at 09:07AM

没有评论:

发表评论