Error Uri.UnescapeDataString on another computer

Everything worked fine on my detector computer and dandy, but when I tested the program on another computer running Windows7, I got System.UriFormatException: Invalid URI: there is an invalid sequence in the line. In the following code:Uri.UnescapeDataString(section);

At first, I thought that the second computer was receiving different data from dev pc, so I copied the html line that did not get into the file and reduced the code to this:

static void Err(string s){/*Picked up by external logging*/}

private static void GetValue()
{
    try
    {
        var html = File.ReadAllText("ld.txt");

        //Retrieve section we want
        var section = Regex.Match(
            html,
            "etc_etc(.*): ",
            RegexOptions.Singleline)
                                .Groups[1].ToString();

        Uri.UnescapeDataString(section);
    }
    catch (Exception ex)
    {
        Err(ex.ToString());
    }
}

Works great on dev, but the second computer gets an exception again. They both download the same html from the same file ld.txt, and then do the same with it .. and both computers are x64 Win7. What gives?

+5
source share
1 answer

UnescapeDataString, , CLR 4.0 4.5

.Net, ( .NET 4.0).

, VS 2012 - (, ,.NET 4.5) .Net 4 ?

.Net 4.0, .Net 4.5

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("CLR version: " + Environment.Version);
        Console.WriteLine(Uri.UnescapeDataString("%"));
    }
}
+8

All Articles