Fix for #1094 - thx xylographe :)

This commit is contained in:
niksedk 2015-08-02 16:53:48 +02:00
parent 8223d60dc4
commit 57f090ac9d

View File

@ -297,13 +297,15 @@ namespace Nikse.SubtitleEdit.Logic
/// Downloads the requested resource as a <see cref="String"/> using the configured <see cref="WebProxy"/>. /// Downloads the requested resource as a <see cref="String"/> using the configured <see cref="WebProxy"/>.
/// </summary> /// </summary>
/// <param name="address">A <see cref="String"/> containing the URI to download.</param> /// <param name="address">A <see cref="String"/> containing the URI to download.</param>
/// <param name="encoding">Encoding for source text</param>
/// <returns>A <see cref="String"/> containing the requested resource.</returns> /// <returns>A <see cref="String"/> containing the requested resource.</returns>
public static string DownloadString(string address, Encoding encoding = null) public static string DownloadString(string address, Encoding encoding = null)
{ {
using (var wc = new WebClient()) using (var wc = new WebClient())
{ {
wc.Proxy = GetProxy(); wc.Proxy = GetProxy();
wc.Encoding = encoding ?? encoding; if (encoding != null)
wc.Encoding = encoding;
return wc.DownloadString(address).Trim(); return wc.DownloadString(address).Trim();
} }
} }