0

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?

Tiago Almeida
  • 14,081
  • 3
  • 67
  • 82

1 Answers1

1

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 GetShortPathName function.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa364989(v=vs.85).aspx

Meik
  • 105
  • 1
  • 5
  • The problem was in the database. The database came with an extra char (from OSX). If I delete that char the "é" it turns into an "e". – Tiago Almeida Feb 04 '13 at 11:02