Skip to content

Commit a35c5a6

Browse files
committed
Fix: Updates fixup codes and tests for issue #8
1 parent 98c08ab commit a35c5a6

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/Features/UnicodeParser.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,13 @@ public static function getBytesNumber($symbol)
5656
$bytesNumber = 1;
5757
if ($ascii > 0x7f) {
5858
switch ($ascii & 0xf0) {
59-
case 0xfd:
60-
$bytesNumber = 6;
61-
break;
62-
case 0xf8:
63-
$bytesNumber = 5;
64-
break;
6559
case 0xf0:
6660
$bytesNumber = 4;
6761
break;
6862
case 0xe0:
6963
$bytesNumber = 3;
7064
break;
71-
case 0xd1:
72-
case 0xd0:
65+
case 0xc0:
7366
$bytesNumber = 2;
7467
break;
7568
}

test/Unit/Utf8StringTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ public function tearDown()
2222
unset($this->encoded, $this->decoded);
2323
}
2424

25+
/**
26+
* Issue #8
27+
*
28+
* @group testing
29+
* @see https://github.com/hidehalo/emoji/issues/8
30+
*/
31+
public function testSpec()
32+
{
33+
$raw = "«";
34+
$encoded = $this->case->encode($raw);
35+
$decoded = $this->case->decode($encoded);
36+
$this->assertSame($raw, $decoded);
37+
// $this->assertSame($raw, $encoded);
38+
}
39+
2540
public function testGetPattern()
2641
{
2742
$ret = $this->case->getPattern();

0 commit comments

Comments
 (0)