适用于Android的Mono:不能打包Unicode资产文件名 [英] Mono for Android: Unicode Assets file names can't be packaged

查看:71
本文介绍了适用于Android的Mono:不能打包Unicode资产文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当资产的文件名中包含Unicode字符(例如中文或阿拉伯文)时,该文件无法部署到程序包中,就会出错.

When an asset contains unicode characters in the file name, for example Chinese or Arabic, the file can not be deployed to a package, it errors out.

将文件重命名为ANSI字符即可解决该问题.

Renaming the file to ANSI characters fixes it.

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

Is there a way to get MonoDevelop + MonoDroid deploy unicode Assets?

推荐答案

我是从MonoDroid团队那里得到的(感谢jonp),它的工作原理是:

I got this from the MonoDroid team (thanks jonp) and it works:

由于Android不支持Unicode资产文件名,因此您可以设置 文件对EmbeddedResource的构建操作,并使用.NET资源访问 资源:

Since Android doesn't support Unicode asset filenames, you can instead set the file's Build action to EmbeddedResource and use .NET resources to access the resource:

  using (var s = new StreamReader (typeof (Activity1).Assembly
       .GetManifestResourceStream ("Úñîćödę.txt")))
   button.Text = s.ReadToEnd ();

(您可能需要更改文件的Resource ID属性以匹配该值 传递给Assembly.GetManifestResourceStream().)

(You may need to change the Resource ID property of the file to match the value passed to Assembly.GetManifestResourceStream().)

这篇关于适用于Android的Mono:不能打包Unicode资产文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆