Validate if a file is UTF-8 encoded.
Value
If validations are successful, validateIsFileUTF8()
returns NULL
.
Otherwise, error is signaled.
Examples
writeLines(c("Hello, world!"), "utf.txt")
writeLines(c("Hello, world!", "\xb5g/L"), "non-utf.txt")
validateIsFileUTF8("utf.txt") #NULL
#> NULL
if (FALSE) validateIsFileUTF8("non-utf.txt") # Error
unlink("utf.txt"); unlink("non-utf.txt")