[Users] Powershell and utf-8?
Thor
thor918 at gmail.com
Sat Jun 30 12:15:23 CEST 2018
Never mind. After spending alot of time, I got it working....
Working code:
$8Bytes = [System.Text.Encoding]::UTF8.GetBytes( $request.innerXml )
$response = Invoke-RestMethod -Method Post -Body $8Bytes -Uri $server
-ErrorAction Stop -ContentType "text/plain; charset=utf8"
Not sure why but the encoding above makes it work as it's suppose to do.
Now it takes scandinavian chars without any problems :D
On 29 June 2018 at 23:26, Thor <thor918 at gmail.com> wrote:
> I have been using powershell againt zimbra for a long time. but now I was
> about to experiment on some code to do search queries, I'm hitting a wall.
> I think perhaps the problem lies in powershell.
> so far I havent managed to get around this yet.
>
> I'm using "Invoke-RestMethod -Method Post" to submitt my zimbra soap
> request.
> everything works if my search is standard english chars. However once I
> add my scandinavian chars. it just dosent work.
>
> and I get this in mailbox.log
>
> misc - Problem parsing XML - Fatal Error: Problem on line 1 of document :
> Invalid byte 1 of 1-byte UTF-8 sequence.
> soap - C: (ParseError:Document parse failed)
> <soap:Body><SearchRequest xmlns="urn:zimbraMail" fullConversation="0"
> limit="100" query="m�terom " types="message" fetch="all" html="1"
> max="10"><header n="X-Spam-Status" /><header n="X-Spam-Flag"
> /></SearchRequest></soap:Body>
>
>
> is suppose to say query="møterom". (i'm looking at mailbox.log using a ssh
> client set to show utf-8)
>
> Anyone hit the same problem and have a workaround ?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zetalliance.org/pipermail/users_lists.zetalliance.org/attachments/20180630/019fd286/attachment.html>
More information about the Users
mailing list