uriref() should create IRIs rather than URIs, so no percent encoding. See https://github.com/CLARIAH/iribaker, https://github.com/dgerber/rfc3987. R-pattern to replace may look like this "(?!(?:[a-zA-Z0-9._~-]|[\\xA0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|%[0-9a-fA-F][0-9a-fA-F]|[!$&'()*+,;=]|:|@|/)(.)" (for stringi::stri_replace_all_regex()), but check this. Consider using the useful bits of url-encode as well.
uriref()should create IRIs rather than URIs, so no percent encoding. See https://github.com/CLARIAH/iribaker, https://github.com/dgerber/rfc3987. R-pattern to replace may look like this"(?!(?:[a-zA-Z0-9._~-]|[\\xA0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|%[0-9a-fA-F][0-9a-fA-F]|[!$&'()*+,;=]|:|@|/)(.)"(forstringi::stri_replace_all_regex()), but check this. Consider using the useful bits of url-encode as well.