Skip to content

Instantly share code, notes, and snippets.

@privefl
Created December 2, 2017 09:27
Show Gist options
  • Save privefl/b8d4dd772430b72b99dc6027fdbf1cfb to your computer and use it in GitHub Desktop.
Save privefl/b8d4dd772430b72b99dc6027fdbf1cfb to your computer and use it in GitHub Desktop.
Convert unicode in HTML to hexa.
unicode2hex <- function(html_file) {
new_text <- gsub(pattern = "&lt;U\\+([0-9]{4})&gt;", replacement = "&#x\\1",
x = readLines(html_file, encoding = "UTF-8"))
writeLines(new_text, con = html_file, useBytes = TRUE)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment