alesimula / wsa_pacman

A GUI package manager and package installer for Windows Subsystem for Android (WSA)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot open .apk file containing Chinese characters in name

hyskylord opened this issue · comments

Hi,
I just noticed that if the .apk file has name with Chinese characters, it will stuck at loading and I won't be able to install the app. After deleting those characters the .apk file works fine.

Just notice this is dulplicated. Not sure why it's closed though.

@hyskylord should be fixed in the latest versions, if it isn't I can't replicate the issue... Could you send me the name of the apk so I can rename one? Maybe it's a specific edge case

@alesimula The latest version doesn't solve my issue. The apk file just refuse to load whenever I put any Chinese character inside. However, I found that the test version you posted on #31 is working for me. So I guess my apk file probably passes the check for some reason and doesn't trigger the symlink solution.

As a follow up, I noticed the name "aaaaaa啊.apk" will work correctly with shortname "AAAAAA~1.APK". The name "啊aaaaaa.apk" will give short name "啊AAAA~1.APK" and is not working. The name "啊.apk" with null short name is not working.

@hyskylord weird, I thought short names were supposed to be ASCII

@alesimula NTFS allows Unicode depending on registry settings, and I believe this is enabled by default Reference

Also the function will return the long path if the file has no short path from MS documentation:

If you call GetShortPathName on a path that doesn't have any short names on-disk, the call will succeed, but will return the long-name path instead. This outcome is also possible with NTFS volumes because there's no guarantee that a short name will exist for a given long name.

@alesimula NTFS allows Unicode depending on registry settings, and I believe this is enabled by default Reference

It is disabled by default.
It still works with me. 啊aaaaaa.apk is converted to AAAAAA~1.APK.

Maybe easiest would be to check if SFN is not available or contains unicode characters and implememt an error message that the file cannot be read. After all just renaming helps.

@akuropka looks like it is enabled by default in Chinese and Japanese systems for some reason, so I guess this is why it doesn't work for some people.

@akuropka @hyskylord I see, I guess I'll also have to check the short name for non-ASCII characters, and use the symlink hack in that case

@alesimula, maybe a stupid question but I did not dig to deep into this, would it not be possible to use a generic link name such as base.apk -> 你好.apk?

@akuropka The way I solved it as mentioned in this other issue, yes, kind of, in a hacky way so it doesn't require admin privileges.

The issue here is, since I took for granted short links were ASCII only, I only checked whether a shortname was found and not its name, so it won't use the fallback hack in this case

This should be pretty easy to fix tho, I'll just have to add an extra check (when I have time)

@hyskylord @akuropka Can anybody confirm the issue is solved in version 1.3.2 ?

It should now also check whether the short name is ASCII, and use the symlink if not

I can only verify that it still works with ASCII short names.

@hyskylord What about you? Do Chinese apk files work on the new version?

Btw I tried to reproduce the issue by setting the flag NtfsAllowExtendedCharacterIn8dot3Name but didn't get Windows to produce a non-ASCII-SFN. The reference is from 2009 and may be outdated. I do have a Windows 10 running in Chinese but it's the standard western version and not the one for the Chinese market (don't know if that makes a difference). I cannot reproduce the issue there as well, so I am out of luck. 😢

Tried several test files and it seems the problem was fixed. Thank you all for the help. 👍