2016-12-05 84 views
0

我試圖在一個圖像的URI傳遞到UriImageSource.Uri但URI字符串內包含20%它獲取錯誤地轉換成白空間Xamarin解析字符串URI替換%20以空格

http://domain.co.uk/Category%20Name/Products/Product-image.jpg 

當此獲得通過我的功能

UriImageSource UriImageSource = new UriImageSource(); 

     UriBuilder Builder = new UriBuilder(productURL); 
     UriImageSource.Uri = Builder.Uri; 
     return UriImageSource; 

的UriImageSource.Uri被轉換爲

解析
http://domain.co.uk/Category Name/Products/Product-image.jpg 

然後,這是在我的應用程序中拋出一個錯誤,因爲該URL包含%20,而不是空白...任何幫助,非常感謝。謝謝!

+1

%20 == 32,這是 「空格」 字符。這些請求應該是等效的 – Jason

+0

現在排除錯誤,謝謝Jason和@idenardi –

回答

0

可以編碼/解碼URL中使用HttpUtility類從System.Web程序

關於這個類

的更多信息,你可以在這裏找到 HttpUtility doc