Argument `x` contains a malformed UTF-8 sequence at index [2], see `?unhandled_ctl`.

Error in nchar_ctl_internal(x = x, type.int = TYPE.INT, allowNA = allowNA,  : 
  Argument `x` contains a malformed UTF-8 sequence at index [2], see `?unhandled_ctl`.

identical(nchar_ctl(x, allowNA = TRUE), nchar(x, allowNA = TRUE))

nzchar_ctl(sprintf("%sa", esc.3), warn = FALSE)

nzchar_ctl(esc.3, ctl = c("sgr", "csi", "esc"), warn = FALSE)

nzchar_ctl(esc.3, ctl = c("c0", "nl"), warn = FALSE)

nzchar_ctl("\n\t\n", ctl = c("nl"), warn = FALSE)

nzchar_ctl("\t\n", ctl = c("nl"), warn = FALSE)

## Bad byte in ESC, generally okay as they are not emitted, saving to
## variables to avoid issues with parse/deparse in unitizer < 1.4.18

Error in nchar_ctl(9:10, warn = 1:3) : 
  Argument `warn` must be TRUE or FALSE.

nchar_ctl("hello\033[31m world", allowNA = 1:3)

Argument `allowNA` must be interpretable as a scalar logical.

Error in nchar_ctl("hello\033[31m world", allowNA = 1:3) : 
  Argument `allowNA` must be interpretable as a scalar logical.

nchar_ctl("hello\033[31m world", keepNA = 1:3)

Argument `keepNA` must be interpretable as a scalar logical.

Error in nchar_ctl("hello\033[31m world", keepNA = 1:3) : 
  Argument `keepNA` must be interpretable as a scalar logical.

nchar_ctl("hello\033[31m world", strip = 1:3)

Parameter `strip` has been deprecated; use `ctl` instead.

Parameter `strip` has been deprecated; use `ctl` instead.
Error in nchar_ctl("hello\033[31m world", strip = 1:3) : 
  Argument `ctl` must be character.

nchar_ctl("hello\033[31m world", ctl = "bananas")

Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")`

Error in nchar_ctl("hello\033[31m world", ctl = "bananas") : 
  Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")`

nchar_ctl("hello\033[31m world", type = NA_character_)

Argument `type` must partial match one of c("chars", "width", "graphemes", "bytes")

Error in nchar_ctl("hello\033[31m world", type = NA_character_) : 
  Argument `type` must partial match one of c("chars", "width", "graphemes", "bytes")