Closed guzy0324 closed 1 year ago
I think I have figured out why this happened. The Chinese characters are full width characters. They are 2 times wider than halfwidth characters.
This fixes the bug.
Have a check at https://github.com/microsoft/winget-cli/issues/1753#issuecomment-1362193458. They provide structured outputs in the powershell module.
Yes, this is a well known problem with WAU. We are aware that we need to move to PowerShell module, but we are waiting for a stable version and we need to rework all the scripts.
Could you make a test for me please? :)
Can you replace your function Get-WingetOutdatedApps.ps1
by this one:
https://github.com/Romanitho/Winget-AutoUpdate/blob/Chinese-bug/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1
Could you make a test for me please? :) Can you replace your function
Get-WingetOutdatedApps.ps1
by this one: https://github.com/Romanitho/Winget-AutoUpdate/blob/Chinese-bug/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1
Line 31 to line 37 and line 47 to line 53 should be:
#Get header titles [without remove seperator]
$index = $lines[$fl] -split '(?<=\s)(?!\s)'
# Line $fl has the header, we can find char where we find ID and Version [and manage non latin characters]
$idStart = [System.Text.Encoding]::UTF8.GetByteCount($($index[0] -replace '[\u4e00-\u9fa5]', '**'))
$versionStart = $idStart + [System.Text.Encoding]::UTF8.GetByteCount($($index[1] -replace '[\u4e00-\u9fa5]', '**'))
$availableStart = $versionStart + [System.Text.Encoding]::UTF8.GetByteCount($($index[2] -replace '[\u4e00-\u9fa5]', '**'))
because the IndexOf
won't work if non-latin characters are replaced with '**'
.
Do you want to PR ? this way you get credited 😊
Do you want to PR ? this way you get credited 😊
Could you make a test for me please? :) Can you replace your function
Get-WingetOutdatedApps.ps1
by this one: https://github.com/Romanitho/Winget-AutoUpdate/blob/Chinese-bug/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1
I noticed that the Handle Chinese chars commit is not merged into the main branch. Also, for lines 61 to 62, the length of id and version should not subtract the $nameDeclination
. Here’s the updated code:
$software.Id = $line.Substring($idStart - $nameDeclination, $versionStart - $idStart).TrimEnd()
$software.Version = $line.Substring($versionStart - $nameDeclination, $availableStart - $versionStart).TrimEnd()
Thanks for your help. Tested on my side, working great :)
The problem
The WAU update often fails, but
winget upgrade --all
works fine.找不到与输入条件匹配的已安装程序包。
in the log meansNo package found matching input criteria.
.I suspect that the failure is caused by wrong application id:
The name and id of the app shown in log are
腾讯会议 Te
andncent.TencentMeeting
, while they should be腾讯会议
andTencent.TencentMeeting
.What version of WAU has the issue?
1.17.5
What version of Windows are you using (ex. Windows 11 22H2)?
Windows 11 22H2
What version of winget are you using?
2023.720.146.667
Log information
Additional information