Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Git have a 'Check ✓' mark in its querystring?

I was searching about something on Git when I noticed that in the query string, there's a parameter utf8 and its value is ! Not utf8=yes or utf8=true.

The full URL is following in Chrome and Firefox:

https://github.com/Modernizr/Modernizr/search?utf8=✓&q=browser&type=

But following in IE:

https://github.com/Modernizr/Modernizr/search?utf8=%E2%9C%93&q=browser&type=

So it seems to be a way of detecting the encoding scheme for the URL, but does anyone know for sure? Also, aren't there any simpler ways of doing this?

like image 572
Nisarg Shah Avatar asked Feb 05 '23 05:02

Nisarg Shah


1 Answers

From a StackExchange question:

By default, older versions of IE (<=8) will submit form data in Latin-1 encoding if possible. By including a character that can't be expressed in Latin-1, IE is forced to use UTF-8 encoding for its form submissions, which simplifies various backend processes, for example database persistence.

If the parameter was instead utf8=true then this wouldn't trigger the UTF-8 encoding in these browsers. This is a hack/feature of Rails (which Github is built with) to force IE to submit UTF-8 text.

It's a feature of Rails (which GitHub is built with), although it's not specific to Rails.

like image 108
Tom Dalling Avatar answered Mar 04 '23 04:03

Tom Dalling