I have to read an image in the Pictures folder that has accents (e.g “éleá”). This name is connected with a database that has also accents. I am using those resources from a client and don’t know if I can change both the database and the file name.
I have sucessfully load images without accents using this code:
IRandomAccessStream stream = StreamWithExternalResource(resourcePath).Result;
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.SetSource(stream);
image.Source = bitmapImage;
Is it possible to read files that have the filename with accents in windows metro/store apps?
The rules for naming files can be found in this MSDN article here:
http://msdn.microsoft.com/en-us/library/aa365247.aspx
There should not be any problem with accents, such as
áéíóú, but you will encounter problems using reserved characters, such as<>|\/.What I would try is hardcoding resourcePath using a constant filename and make sure that nothing odd comes from the database. Another test would be converting the long filename into a short filename (8.3 MS-DOS format) using the
GetShortPathNamefunction.http://msdn.microsoft.com/en-us/library/windows/desktop/aa364989(v=vs.85).aspx