0

I am writing an application that use google web-risk to inspect urls. first step google require is to Canonicalize the URL before using the service. The following link contains an explanation, However, escaped chars are a real pain I still try to figure it out. https://cloud.google.com/web-risk/docs/urls-hashing

Third, repeatedly remove percent-escapes from the URL until it has no more percent-escapes.

appreciate for help regarding this

I tried the following:

string RemoveEscaped(string canonicalizedUrl) { //repeatedly remove percent-escapes from the URL until it has no more percent-escapes. //this is necessary because the percent-escapes may be encoding other percent-escapes while (true) { string newUrl = Uri.UnescapeDataString(canonicalizedUrl); if (newUrl == canonicalizedUrl) { break; }

            canonicalizedUrl = newUrl;
        }

        return canonicalizedUrl;
    }
Neo
  • 1
  • 1

0 Answers0