Mono for Android:无法打包Unicode Assets文件名

Ian*_*ink 2 unicode mono android monodevelop xamarin.android

当资产在文件名中包含unicode字符(例如中文或阿拉伯语)时,该文件无法部署到包中,它会出错.

将文件重命名为ANSI字符可以修复它.

有没有办法让MonoDevelop + MonoDroid部署unicode资产?

jon*_*onp 6

我无法在任何地方找到此文档,但资产文件名必须是ASCII,因为这是该aapt工具所需的内容:

/*
 * Names of asset files must meet the following criteria:
 *
 *  - the filename length must be less than kMaxAssetFileName bytes long
 *    (and can't be empty)
 *  - all characters must be 7-bit printable ASCII
 *  - none of { '/' '\\' ':' }
 *
 * Pass in just the filename, not the full path.
 */
static bool validateFileName(const char* fileName)
{
    const char* cp = fileName;
    size_t len = 0;

    while (*cp != '\0') {
        if ((*cp & 0x80) != 0)
            return false;           // reject high ASCII
        if (*cp < 0x20 || *cp >= 0x7f)
            return false;           // reject control chars and 0x7f
        if (strchr(kInvalidChars, *cp) != NULL)
            return false;           // reject path sep chars
        cp++;
        len++;
    }

    if (len < 1 || len > kMaxAssetFileName)
        return false;               // reject empty or too long

    return true;
}
Run Code Online (Sandbox Code Playgroud)

我不知道为什么Android/aapt有这个要求.