Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appropriate character encoding / collation to store URLs?

My web application stores URL segments in a database. These URL segments are based on user-submitted content.

What collation should I use for character strings that will appear in URLs?

My assumption is ASCII General CI (?) based on this question: Which characters make a URL invalid?

like image 313
Dolph Avatar asked Feb 26 '10 19:02

Dolph


1 Answers

It doesn't really matter as far as I can see. The characters valid in a URL are represented in any character set I know of, and I wouldn't use different collations between tables and columns - you'll get "illegal mix of collations" problems on any attempt to join them or perform any other kind of cross-column or cross-table operation (see my recent problem here).

Correct me if I'm wrong of course.

like image 176
Pekka Avatar answered Oct 26 '22 18:10

Pekka