'Powershell, how to encode input value?

guys

I have a problem charset.

I want to input a value in a website's input tag using powershell. A value is korean but result is broken..

I think it's a encoding problem but I couldn't find perfect solution.

this is my code

$KOR_VAL="예시";

$ie=New-Object -com 'InternetExplorer.Application';
$ie.Visible=$true;

$ie.Navigate("https://www.naver.com");
while ($ie.Busy -eq $true) {Start-Sleep -seconds 1;}

$sText=$ie.Document.getElementByID("query");
$sText.Value=$KOR_VAL;

I expected "예시" in input tag, but result is like "궰퉼퓨" (broken).

What should I do to fix? Please teach me!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source