MCPcopy
hub / github.com/go-yaml/yaml / is_printable

Function is_printable

yamlprivateh.go:85–95  ·  view source on GitHub ↗

Check if the character at the start of the buffer can be printed unescaped.

(b []byte, i int)

Source from the content-addressed store, hash-verified

83
84// Check if the character at the start of the buffer can be printed unescaped.
85func is_printable(b []byte, i int) bool {
86 return ((b[i] == 0x0A) || // . == #x0A
87 (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E
88 (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF
89 (b[i] > 0xC2 && b[i] < 0xED) ||
90 (b[i] == 0xED && b[i+1] < 0xA0) ||
91 (b[i] == 0xEE) ||
92 (b[i] == 0xEF && // #xE000 <= . <= #xFFFD
93 !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF
94 !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF))))
95}
96
97// Check if the character at the specified position is NUL.
98func is_z(b []byte, i int) bool {

Calls

no outgoing calls

Tested by

no test coverage detected