Quantcast
Channel: Daily Python-URL! (from the Secret Labs)
Viewing all articles
Browse latest Browse all 20

Unicode and permalinks

$
0
0
Eli Golovinsky: Unicode and permalinks ["The idea of a permalink is to take the title (of a blog post or a test) and replace any characters that aren't numbers or letters with an underscore or a hyphen. Using this simple scheme, 'Unicode and permalinks' becomes 'unicode-and-permalinks', which is quite suitable for use in a URL. The implementation is a simple regular expression /.../ While this code works perfectly for the English language, it doesn’t work at all if string is a Unicode string containing something in Hebrew, Russian or Polish - language that some of our customers use. And so, I set out to write code that will essentially behave like the regular expression above, but will work for letters and numbers in all the languages of the world."]

Viewing all articles
Browse latest Browse all 20

Trending Articles