Index: trunk/tests/UtilitiesTest.php
===================================================================
--- trunk/tests/UtilitiesTest.php	(revision 720)
+++ trunk/tests/UtilitiesTest.php	(revision 722)
@@ -283,3 +283,46 @@
         }
     }
+
+    function test_URLSlug()
+    {
+        $strings = [
+            'This becomes a slug' => 'this-becomes-a-slug',
+            'http://äŸå­.å·ç­çºž/?x=y&1=2#asdf' => 'http-%e4%be%8b%e5%ad%90-%e5%8d%b7%e7%ad%92%e7%ba%b8-x-yand1-2-asdf',
+            'Ã Ã€ Ã Ã¶ Ã ÃŒ Ã a Ã ÃŠ Ã Ãž Ã
+ Ã¥' => 'a-a-o-o-u-u-sz-a-ae-ae-o-o-a-a',
+            ' - ' => '',
+            '' => '',
+            ' ' => '',
+            '?' => '',
+            'a file.JPG' => 'a-file-jpg',
+            '/a/path/file.JPG' => 'a-path-file-jpg',
+            '/a/directory/' => 'a-directory',
+            '/' => '',
+            'this-is-already-a-slug' => 'this-is-already-a-slug',
+            'HTML entities&nbsp;ok&mdash;or not!' => 'html-entities-ok-or-not',
+            '<p>tagsâŠ</p>' => 'ltpgttagshelliplt-pgt',
+            'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.' => 'lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr-sed-diam-nonumy-eirmod-tempor-invidunt-ut-labore-et-dolore-magna-aliquyam-erat-sed-diam-voluptua-at-vero-eos-et-accusam-et-justo-duo-dolores-et-ea-rebum-stet-clita-kasd-gubergren-no-sea-takimata-sanctus-est-lorem-ipsum-dolor-sit-amet-lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr-sed-diam-nonumy-eirmod-tempor-invidunt-ut-labore-et-dolore-magna-aliquyam-erat-sed-diam-voluptua-at-vero-eos-et-accusam-et-justo-duo-dolores-et-ea-rebum-stet-clita-kasd-gubergren-no-sea-takimata-sanctus-est-lorem-ipsum-dolor-sit-amet-lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr-sed-diam-nonumy-eirmod-tempor-invidunt-ut-labore-et-dolore-magna-aliquyam-erat-sed-diam-voluptua-at-vero-eos-et-accusam-et-justo-duo-dolores-et-ea-rebum-stet-clita-kasd-gubergren-no-sea-takimata-sanctus-est-lorem-ipsum-dolor-sit-amet',
+            // Binary data.
+            'xÃâ¡-]ÃÂ¯pÄ±
+oË;ÃÂ¯)0Ã±]Ã 
+fhHÂ¡Ãg+Â£KËH
+Ën*âÃ
+â¡ÃËÃŒQÃÃµ.âulÃâ ËyÃËÃ¯uâ«
+âºÂ¢>kÆâÃŠÃ¬+Â¯âË âE
+Â¬Â±ÃhâUÃ·%>âï¬ï¬â€1
+' => 'xodagger-emacrp%c4%b1-otildecmacr0nafhhiexcleg-poundk%cb%87h-nedaggeritildeuqoo-lozulineyatildeiuintcentgtkfnofsumaei-macrinfin-enotplusmnahudividegtasymp%ef%ac%81%ef%ac%81le1',
+            '-- repeated - characters -- so---extra - - - look-out!' => 'repeated-characters-so-extra-look-out',
+            'NesthÃ€kchen\'s Teenage Years' => 'nesthakchens-teenage-years',
+            'áŒÏÎ±ÏÎœÎµá¿Ï AkharneÃ®s' => '%e1%bc%88chialpharhonuepsilon%e1%bf%96sigmaf-akharneis',
+            'ÐÐœÑÐŸÐœ ÐÐ°Ð²Ð»ÐŸÐ²ÐžÑ Ð§ÐµÑ
+ÐŸÐ²' => '%d0%90%d0%bd%d1%82%d0%be%d0%bd-%d0%9f%d0%b0%d0%b2%d0%bb%d0%be%d0%b2%d0%b8%d1%87-%d0%a7%d0%b5%d1%85%d0%be%d0%b2',
+            'Demain dÃšs l\'aube' => 'demain-des-laube',
+            'Demain dÃšs lâaube' => 'demain-des-laube',
+        ];
+        foreach ($strings as $input => $expected) {
+            // printf("%s\n", URLSlug($input));
+            $result = URLSlug($input);
+            $this->assertEquals($expected, $result, sprintf('Failed with input: %s', $input));
+        }
+    }
 }
