Mobile app version of vmapp.org
Login or Join
Goswami781

: Should URLs with UTF8 characters be encoded in HTML? I'm thinking of names and stuff containing accented characters. E.g.is there a difference between: <a href="http://example.com/thing?name=forêt">link</a>

@Goswami781

Posted in: #Html #Links #Url #UrlEncoding

I'm thinking of names and stuff containing accented characters.

E.g.is there a difference between:

<a href="http://example.com/thing?name=forêt">link</a>


and

<a href="http://example.com/thing?name=for%C3%AAt">link</a>


?

Do browsers handle these the same? Or is there some compelling reason to encode these links?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Goswami781

2 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

Do browsers handle these the same?


Yes, all (modern) browsers handle these the same. In that all (modern) browsers implicitly URL encode (ie. percent-encode) the URL if you don't explicitly encode this yourself in the HTML source.

In both cases, the browser will implicitly request the percent-encoded URL when a user clicks the link. Select "Copy link address" from the browser's context menu and you copy the percent-encoded URL in both cases. Reading the href attribute of both links using JavaScript returns the percent-encoded URL.

In fact, I believe HTML5 allows unencoded unicode characters: stackoverflow.com/a/19542940/369434
A potential problem might just be "old browsers". How old I don't know. But "old" might just be too old to worry about. (?)

10% popularity Vote Up Vote Down


 

@Bryan171

W3C says URLs can only be sent over the Internet using the ASCII character-set. You will need to convert those characters to something. People often replace unsafe characters with their % encoded form. A percent-encoded reference can be found here.

Here is there reference: www.w3.org/Addressing/URL/4_URI_Recommentations.html

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme