Why is the return value of String.addingPercentEncoding() optional?

I filed a bug report with Apple about this, and heard back โ€” with a very helpful response, no less! Turns out (much to my surprise) that itโ€™s possible to successfully create Swift strings that contain invalid Unicode in the form of unpaired UTF-16 surrogate chars. Such a string can cause UTF-8 encoding to fail. … Read more

How do you unescape URLs in Java?

This is not unescaped XML, this is URL encoded text. Looks to me like you want to use the following on the URL strings. URLDecoder.decode(url); This will give you the correct text. The result of decoding the like you provided is this. http://cliveg.bu.edu/people/sganguly/player/ Rang De Basanti – Tu Bin Bataye.mp3 The %20 is an escaped … Read more

GETting a URL with an url-encoded slash

This is a terrible hack, bound to be incompatible with future versions of the framework and so on. But it works! (on my machine…) Uri uri = new Uri(“http://example.com/%2F”); ForceCanonicalPathAndQuery(uri); using (WebClient webClient = new WebClient()) { webClient.DownloadData(uri); } void ForceCanonicalPathAndQuery(Uri uri){ string paq = uri.PathAndQuery; // need to access PathAndQuery FieldInfo flagsFieldInfo = typeof(Uri).GetField(“m_Flags”, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)