pub(crate) unsafe fn charsxp_to_string_lossy(charsxp: SEXP) -> Option<String>Expand description
Convert CHARSXP to an owned, lossy String.
NA/null-defensive: returns None for NA_character_, R_NilValue, or a
null SEXP. Text is read as charsxp_to_cow_lossy reads it: Latin-1 is
translated, and only a string marked as bytes or one that is not valid
UTF-8 is decoded lossily (U+FFFD) rather than rejected. Unlike
try_charsxp_to_str (the hot path for argument conversions), this is for
defensive reads of arbitrary R objects — S4 class attributes,
geterrmessage() output, vctrs field names, tzone attributes — where
the CHARSXP’s origin and encoding aren’t guaranteed.
§Safety
charsxp must be a valid SEXP. It may be R_NilValue or a null SEXP
(both map to None); if it is neither of those and not NA_character_,
it must actually be a CHARSXP.