Bug 5017 - Can't deploy Unicode Assets.txt
Summary: Can't deploy Unicode Assets.txt
Alias: None
Product: Android
Classification: Xamarin
Component: Debugger ()
Version: 4.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2012-05-10 19:17 UTC by Ian
Modified: 2012-05-22 16:40 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Sample of Assets not deployable (149.24 KB, application/zip)
2012-05-10 19:20 UTC, Ian

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Ian 2012-05-10 19:17:09 UTC
Create a text file in the Assets folder named:

Barazia e Burrave dhe Grave Një Realitet i ri.txt

Try to deploy to a device.

It errors out saying the file can't be found can't be found. If I just use ANSI characters it works fine.

It often converts to HTML characters the unicode filename as well. Like:

 Hell&SOMECODE;o mom.txt 

when the text file is unicode in Turkish or the like.
Comment 1 Ian 2012-05-10 19:17:39 UTC

/Library/Frameworks/Mono.framework/External/xbuild/Novell/Novell.MonoDroid.Common.targets: Error: Tool exited with code: 1. Output: /Users/vink/Dropbox/Dev/iOS/UNIVERSAL/BIC/Portal/Android/UI/obj/Debug/assets/Data/Albanian/Barazia e Burrave dhe Grave Një Realitet i ri.txt: error: Invalid filename.  Unable to add.
Comment 2 Ian 2012-05-10 19:20:51 UTC
Created attachment 1855 [details]
Sample of Assets not deployable
Comment 3 Ian 2012-05-10 19:21:43 UTC
These files work fine in MonoTouch when set to "Content" there
Comment 4 Ian 2012-05-10 19:24:26 UTC
Just tried Arabic file names, those fail to "Deploy to Device."
Comment 5 Jonathan Pryor 2012-05-22 16:40:17 UTC
Android requires ASCII filenames for assets. This doesn't appear to be publicly documented anywhere, but the `aapt` source code has an ASCII check:

 * 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.

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 ();

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