Skip to main content

Module encoding

Module encoding 

Source
Expand description

Encoding / locale probing utilities.

This module exists mainly for debugging + experiments around R’s string encodings. R’s runtime has both:

  • per-CHARSXP encoding tags (UTF-8 / Latin-1 / bytes / native)
  • global/locale-level settings (native encoding, UTF-8 locale flags)

§Availability

The global signals are non-API (from Defn.h) and require the nonapi feature. Additionally, these symbols are not exported from R’s shared library, so miniextendr_encoding_init() only works when:

  • Embedding R via miniextendr-engine (which links directly to R internals)
  • Running on platforms where these symbols happen to be exported

For R packages (loaded via .Call), these symbols are typically unavailable, so miniextendr_encoding_init() is disabled by default in the entrypoint. The module is still useful for standalone Rust applications embedding R.

Structs§

REncodingInfo
Cached snapshot of R’s encoding / locale state at init time.

Statics§

ENCODING_INFO 🔒

Functions§

encoding_info
Return the cached encoding info (if miniextendr_encoding_init() has run).
miniextendr_assert_utf8_locale
Assert that R’s locale is UTF-8.
miniextendr_encoding_init
Initialize / snapshot R’s encoding state.