How would you create a string of all UTF-8 characters?

前端 未结 5 561
北海茫月
北海茫月 2021-01-02 20:11

There are many ways to represent the +1 million UTF-8 characters. Take the latin capital \"A\" with macron (Ā). This is unicode code point U+0100,

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 20:49

    >6,1<<7|191&$n):
    ($n<(1<<16)?pack($f,224|$n>>12,1<<7|63&$n>>6,1<<7|63&$n):
    ($n<(1<<20|1<<16)?pack($f,240|$n>>18,1<<7|63&$n>>12,1<<7|63&$n>>6,1<<7|63&$n):'')));
    }
    
    echo implode('',array_map('chr_utf8',range(0,65535)));
    
    // Output a big string, you can increase the range to 1114111…
    

提交回复
热议问题