/ 工具
■/ 工具搜尋
109 款工具
/ Unicode 跳脫編碼器
/ 選定的工具
■Unicode 跳脫編碼器 - 免費 編碼與解碼 工具
在文字與 Unicode 跳脫序列之間相互轉換
■ 01
甚麼是 Unicode 跳脫序列?
Unicode 跳脫序列是一種以 ASCII 字元表示 Unicode 字元的方式。它們常用於程式語言與標記語言中,用來包含可能無法直接輸入的特殊字元,…
■ 02
運作原理是甚麼?
支援的格式:JavaScript:BMP 字元使用 \uXXXX,U+FFFF 以上的字元使用代理對。Python:BMP 使用 \uXXXX,擴充字元使用 \UXXXXXXXX。CSS:使用 \XXXX 後接一個空格。HTML:使…
■ 03
範例情境
涵蓋 JavaScript 格式、HTML 實體與 CSS 跳脫,讓你能快速比較常見的輸入與輸出。
/ 相關工具
/ 程式碼
■選定工具的原始碼,與右側的即時版本並列顯示。
/ 原始碼
TypeScript
typescript
// Unicode escape encoding in different formats
function toJavaScriptEscape(text: string): string {
return Array.from(text)
.map(char => {
const cp = char.codePointAt(0)!;
if (cp <= 0xFFFF) {
return `\\u${cp.toString(16).padStart(4, '0')}`;
}
// Surrogate pairs for characters outside BMP