Permalink
Browse files

Handles entities properly

 - fixes #32
  • Loading branch information...
1 parent 3c71252 commit af4445d3f148b873edac71c78abc148880810358 @iBotPeaches iBotPeaches committed Dec 14, 2016
Showing with 10 additions and 7 deletions.
  1. +2 −2 app/Http/helpers.php
  2. +8 −5 tests/Issue32Test.php
@@ -28,7 +28,7 @@ function bungie($url)
function dtrgrimoire($card)
{
- return url('http://db.destinytracker.com/grimoire/' . slug($card->theme->themeId) . '/' . slug($card->page->pageName) . '/' . slug($card->cardName));
+ return url('http://db.destinytracker.com/grimoire/') . slug($card->theme->themeId) . '/' . slug($card->page->pageName) . '/' . slug($card->cardName);
}
function dtritem($item)
@@ -47,7 +47,7 @@ function slug($name)
- Replace spaces with hypens.
*/
- $name = html_entity_decode($name);
+ $name = html_entity_decode($name, ENT_QUOTES | ENT_XML1, 'UTF-8');
$name = strtolower(iconv("UTF-8", "ASCII//TRANSLIT//IGNORE", $name));
$name = preg_replace('/[^a-z0-9 -]/', '', $name);
$name = preg_replace('!\s+!', ' ', $name);
View
@@ -9,19 +9,22 @@ class Issue32Test extends TestCase
*/
public function testUnicodeDuringSlugging()
{
- $ir = 'Ir Yût, the Deathsinger';
+ $ir = 'Ir Yût, the Deathsinger';
$this->assertEquals('ir-yut-the-deathsinger', slug($ir));
- $alzok = 'Alzok Däl, Gornuk Däl, Zyrok Däl';
+ $alzok = 'Alzok Däl, Gornuk Däl, Zyrok Däl';
$this->assertEquals('alzok-dal-gornuk-dal-zyrok-dal', slug($alzok));
- $balwur = 'Balwûr';
+ $balwur = 'Balwûr';
$this->assertEquals('balwur', slug($balwur));
- $primus = 'Primus Ta\'aun';
+ $primus = 'Primus Ta'aun';
$this->assertEquals('primus-taaun', slug($primus));
- $norusk = 'Noru\'usk, Servant of Oryx';
+ $norusk = 'Noru'usk, Servant of Oryx';
$this->assertEquals('noruusk-servant-of-oryx', slug($norusk));
+
+ $lysanders = 'Lysander's Cry';
+ $this->assertEquals('lysanders-cry', slug($lysanders));
}
}

0 comments on commit af4445d

Please sign in to comment.