0

Hi I have developed an apps in Windows Phone 8, which download the images from the server to the phone, And each and every folder is the pictures and the thumbnails are displaying, without any problem. But if there is a folder with "#" symbol like Fold#er, then inside the folder all the images are displyed, but the thumbnails are not displayed, it is empty.

I have debugged the code and there is no issue, no exception. Even in the server I have tested it is working fine with Thumbnails and pictures.

Any idea why is # symbol creating this issue?

Thanks

Debhere
  • 1,055
  • 2
  • 19
  • 41

2 Answers2

1

The hash (#) is a URL anchor. It sounds like you need to URL encode your paths. E.g. Fold%23er

Blazes
  • 4,721
  • 2
  • 22
  • 29
  • then how shall I resolve this? Shall I change the # to %23? like `if (imgTinyThumbnail.FilePath.Contains("#")) { imgTinyThumbnail.FilePath.Replace(("#", "%23"); }` – Debhere Mar 27 '13 at 11:41
0

after a lot of research I found the solution, thanks to @Blazes for the suggestions, but it was different issue. In my application whenever it found any special character like #, ^,<, > etc it just truncate the string until that and the worst part is it was not throwing any error/ exception. Now I have used

string escapeStr = Uri.EscapeDataString(filepath);

This line was enough to solve the problem, but sometimes the entire string needs to be escape encoding

like suppose you have a string which is like

string request = "Username" + uname + "Password" +Pwd + "Filepath" + filepath;

then in this case

string unamestr = Uri.EscapeDataString(uname);

string Pwdstr = Uri.EscapeDataString(Pwd );

will not help, because you are dealing with unicode character. So in that case the entire string need to be encode like this

string request = Uri.EscapeDataString("Username" + uname + "Password" +Pwd + "Filepath" + filepath);

This is the solution I found through trial / error method and from SO.

Thanks

Debhere
  • 1,055
  • 2
  • 19
  • 41