-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
When I encrypt and decrypt data that has UTF-8 encoding on a Windows device, I get messed up results:
"õ" %>%
enc2utf8() %>%
encrypt_vec(public_key_path = paste0(key_file_name, ".pub")) %>%
decrypt_vec(private_key_path = key_file_name)
[1] "Ƶ"
It seems to happen because rawToChar() function uses whatever the default locale/encoding for the current Windows OS is.
"õ" %>%
enc2utf8() %>%
charToRaw() %>%
rawToChar()
[1] "Ƶ"
The problem could be fixed by adding an extra step to convert decrypted strings to UTF-8
"õ" %>%
enc2utf8() %>%
charToRaw() %>%
rawToChar() %>%
stringi::stri_conv("UTF-8")
[1] "õ"
Love your package, cheers!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels