Byte order mark: Difference between revisions
Jump to navigation
Jump to search
→How to remove Byte order mark
| Line 93: | Line 93: | ||
* [https://stackoverflow.com/questions/10290849/how-to-remove-multiple-utf-8-bom-sequences php - How to remove multiple UTF-8 BOM sequences - Stack Overflow] | * [https://stackoverflow.com/questions/10290849/how-to-remove-multiple-utf-8-bom-sequences php - How to remove multiple UTF-8 BOM sequences - Stack Overflow] | ||
* [https://stackoverflow.com/questions/22600235/remove-or-match-a-unicode-zero-width-space-php replace - Remove or match a Unicode Zero Width Space PHP - Stack Overflow] | * [https://stackoverflow.com/questions/22600235/remove-or-match-a-unicode-zero-width-space-php replace - Remove or match a Unicode Zero Width Space PHP - Stack Overflow] | ||
<pre> | |||
// 原始資料:程式碼編輯器會顯示為 ZWNBSP,但是一般編輯器試看不到 | |||
$text = "\xef\xbb\xbf" . "單位名稱"; | |||
// 移除 BOM | |||
$text = preg_replace('/[\x{200B}-\x{200D}\x{FEFF}]/u', '', $text); | |||
</pre> | |||
== References == | == References == | ||