Skip to content

Commit

Permalink
More general escape_unicode()
Browse files Browse the repository at this point in the history
  • Loading branch information
clente committed Jan 31, 2022
1 parent a676ff8 commit d1dd0ef
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions R/escape_unicode.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ escape_unicode <- function() {

# Escape accented characters from one character vector
escape <- . %>%
stringi::stri_escape_unicode() %>%
stringi::stri_replace_all_fixed("\\\\", "#$!*%") %>%
stringi::stri_replace_all_fixed("\\", "") %>%
stringi::stri_replace_all_fixed("#$!*%", "\\") %>%
stringr::str_replace_all("(u00[:alnum:]{2})", "\\\\\\1")
iconv("UTF-8", "ASCII", sub = "Unicode") %>%
stringr::str_replace_all("<U\\+([0-9A-F]+)>", "\\\\u\\1")

# Escape accented characters from every line of the document
escape_all <- . %>%
Expand Down

0 comments on commit d1dd0ef

Please sign in to comment.