我已经创建了一个脚本:
$API = "<That is secret>"
$LatLng = "47.5560960732389,7.5917686522"
$URL = "https://maps.googleapis.com/maps/api/geocode/json?latlng=$LatLng&key=$API"
$URL
$Result = Invoke-WebRequest -Uri $URL -ContentType "application/json; charset=UTF-8" -Method Get -UseBasicParsing | ConvertFrom-Json
if($Result.status -eq "OK")
{
$Result.results.formatted_address
Write-Host "------------------------------------"
$Result.results.formatted_address[0]
[Text.Encoding]::UTF8.GetString([Text.Encoding]::GetEncoding(28591).GetBytes($Result.results.formatted_address[0]))
}
输出结果如下所示:
M??nsterpl. 12, 4051 Basel, Switzerland
M??nsterpl. 14, 4051 Basel, Switzerland
M??nsterpl. 14, 4051 Basel, Switzerland
M??nsterberg 13, 4051 Basel, Switzerland
HH4R+CP Basel, Switzerland
M??nsterpl. 9, 4051 Basel, Switzerland
Altstadt Grossbasel, Basel, Switzerland
4051 Basel, Switzerland
Basel, Switzerland
Basel-Stadt, Switzerland
Basel City, Switzerland
Switzerland
------------------------------------
M??nsterpl. 12, 4051 Basel, Switzerland
M??nsterpl. 12, 4051 Basel, Switzerland
如果我在Firefox中输入创建的URL(存储在变量$URL中)复制并粘贴,地址将以正确的布局显示:
我可以做些什么来解决这个问题?谢谢..。StingPilot
1条答案
按热度按时间o4hqfura1#
只有这个管用..。