Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding sleuthing function #189

Open
hadley opened this issue Sep 21, 2015 · 1 comment
Open

Encoding sleuthing function #189

hadley opened this issue Sep 21, 2015 · 1 comment

Comments

@hadley
Copy link

hadley commented Sep 21, 2015

Sometimes you know what a character should be, and you know how it's stored in a file, and you want to figure out what encoding it might have been (e.g. tidyverse/readr#252). It would be helpful to have something to help automate the search, e.g.

x <- "Ü"
encs <- names(stri_enc_list())
conv <- lapply(encs, function(to) stri_conv(x, "UTF-8", to, to_raw = TRUE)[[1]])
names(conv) <- encs
Filter(function(x) identical(x[[1]], charToRaw("\x86")), conv)
@gagolews
Copy link
Owner

gagolews commented Oct 1, 2015

good idea, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants