示例#1
0
 /**
  * Normalize string (RFC 3454 section 4)
  */
 protected function normalize($codepoints)
 {
     $string = UnicodeUtil::codepointsToString($codepoints, 'UTF-8');
     $string = Normalizer::normalize($string, Normalizer::FORM_KC);
     return UnicodeUtil::stringToCodepoints($string, 'UTF-8');
 }
示例#2
0
 public function testCodepointsFromSMPString()
 {
     $codepoints = UnicodeUtil::stringToCodepoints("mathplane: 𝛂𝛽𝜸𝝳𝟒𝟚");
     $expected = array(0x6d, 0x61, 0x74, 0x68, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x3a, 0x20, 0x1d6c2, 0x1d6fd, 0x1d738, 0x1d773, 0x1d7d2, 0x1d7da);
     $this->assertEquals($expected, array_values($codepoints));
 }