Files
larksuite-cli/shortcuts/common/sanitize.go
梁硕 83dfb068ad feat: open-source lark-cli — the official CLI for Lark/Feishu
Change-Id: I113d9cdb5403cec347efe4595415e34a18b7decf
2026-03-28 10:36:25 +08:00

24 lines
667 B
Go

// Copyright (c) 2026 Lark Technologies Pte. Ltd.
// SPDX-License-Identifier: MIT
package common
// IsDangerousUnicode reports whether r is a Unicode character that can cause
// terminal injection: BiDi overrides, zero-width characters, and Unicode line
// terminators.
func IsDangerousUnicode(r rune) bool {
switch {
case r >= 0x200B && r <= 0x200D: // ZWSP / ZWJ / ZWNJ
return true
case r == 0xFEFF: // BOM / ZWNBSP
return true
case r >= 0x202A && r <= 0x202E: // BiDi: LRE, RLE, PDF, LRO, RLO
return true
case r >= 0x2028 && r <= 0x2029: // LS, PS
return true
case r >= 0x2066 && r <= 0x2069: // LRI, RLI, FSI, PDI
return true
}
return false
}