获取PHP中所有UTF-8空格字符的完整列表的最简单方法 [英] Simplest way to get a complete list of all the UTF-8 whitespace characters in PHP
本文介绍了获取PHP中所有UTF-8空格字符的完整列表的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在PHP中,最优雅的方法是获取所有Unicode的完整列表(字符串数组)
In PHP, what's the most elegant way to get the complete list (array of strings) of all the Unicode whitespace characters, encoded in utf8?
我需要它来生成测试数据.
I need that to generate test data.
推荐答案
此电子邮件(存档的此处)包含所有已编码的Unicode空格字符的列表在UTF-8,UTF-16和HTML中.
This email (archived here) contains a list of all Unicode whitespace characters encoded in UTF-8, UTF-16, and HTML.
在存档的链接中查找"utf8_whitespace_table"功能.
In the archived link look for the 'utf8_whitespace_table' function.
static $whitespace = array(
"SPACE" => "\x20",
"NO-BREAK SPACE" => "\xc2\xa0",
"OGHAM SPACE MARK" => "\xe1\x9a\x80",
"EN QUAD" => "\xe2\x80\x80",
"EM QUAD" => "\xe2\x80\x81",
"EN SPACE" => "\xe2\x80\x82",
"EM SPACE" => "\xe2\x80\x83",
"THREE-PER-EM SPACE" => "\xe2\x80\x84",
"FOUR-PER-EM SPACE" => "\xe2\x80\x85",
"SIX-PER-EM SPACE" => "\xe2\x80\x86",
"FIGURE SPACE" => "\xe2\x80\x87",
"PUNCTUATION SPACE" => "\xe2\x80\x88",
"THIN SPACE" => "\xe2\x80\x89",
"HAIR SPACE" => "\xe2\x80\x8a",
"ZERO WIDTH SPACE" => "\xe2\x80\x8b",
"NARROW NO-BREAK SPACE" => "\xe2\x80\xaf",
"MEDIUM MATHEMATICAL SPACE" => "\xe2\x81\x9f",
"IDEOGRAPHIC SPACE" => "\xe3\x80\x80",
);
这篇关于获取PHP中所有UTF-8空格字符的完整列表的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文