question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why replace _ in url?

See original GitHub issue

Hi, @FlorianRappl Why are you replacing underscores in the url with nothing?

    [TestMethod]
    public void TestMethod2()
    {
        //
        Url url = new Url("https://will_be_replaced.but.why/");
            //
        Assert.AreEqual("https://will_be_replaced.but.why/", url.Href);
    }

gives

Assert.AreEqual failed. Expected:<https://will_be_replaced.but.why/>. Actual:<https://willbereplaced.but.why/>.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
FlorianRapplcommented, Oct 24, 2016

@ushenkodmitry see WHATWG URL specification. Also Google has a nice paragraph about why URLs with underscores will be downrated.

Also please read the Wikipedia entry on host names:

While a hostname may not contain other characters, such as the underscore character (_), other DNS names may contain the underscore.[4] Systems such as DomainKeys and service records use the underscore as a means to assure that their special character is not confused with hostnames. For example, _http._sctp.www.example.com specifies a service pointer for an SCTP capable webserver host (www) in the domain example.com. Note that some applications (e.g. Microsoft Internet Explorer) won’t work correctly if any part of the hostname contains an underscore character.[5]

0reactions
FlorianRapplcommented, Oct 25, 2016

Agreed - I think we need to tolerate this. Fixed as PR #446.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PHP - How to replace special characters for url
I am trying to convert special characters (eg. + , / , & , % ) which I will use them for a...
Read more >
location: replace() method - Web APIs - MDN Web Docs
The replace() method of the Location interface replaces the current resource with the one at the provided URL. The difference from the ...
Read more >
hx-replace-url Attribute
The hx-replace-url attribute allows you to replace the current url of the browser location history. The possible values of this attribute are:.
Read more >
Replace URL
Replace URL replace the specified words with new words in the address bar. 1. Please specify old words(or regular expressions) and new words ......
Read more >
How To Replace URLs In WordPress
Now let's get started replacing the URLs in your WordPress website. To begin, go to the plugin settings located at Tools>Better Search Replace....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found