powershell调增值税发票ocr中文乱码
zl998100 发布于2020-09 浏览:1825 回复:1
0
收藏

powershell  调用  增值税 ocr   接口返回结果 中文乱码, 有没有大佬帮忙看看?

我用Python 调用都正常的, 照着Python 代码写了一版powershell 就是乱码

我打印输出了 经过base64编码的 图片字符串   python 和 powershell 的结果都一样的,不知道问题出在哪里了,啊啊啊啊!!!

$image_bytes=[System.IO.File]::ReadAllBytes("C:\Users\louis\Desktop\vat_ocr\test.jpg")
$image_base64= [System.Convert]::ToBase64String($image_bytes)
$access_token = "access_token"
$url = "https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice"
$param = @{image = $image_base64; 
           access_token= $access_token}
$headers = @{'content_type' = 'application/x-www-form-urlencoded'}
$response = curl -Uri $url -Body $param -Headers $headers -Method Post
$response.ToString()| ConvertFrom-Json|%{$_.words_result}
收藏
点赞
0
个赞
共1条回复 最后由用户已被禁言回复于2022-04
#2深圳九曲范深回复于2020-09

python 和 powershell   代码不一样的吧,可以去GitHub找找

0
TOP
切换版块