Skip to content

Commit

Permalink
chore: Work around problem constructing function calls in corner cases
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr authored and aviator-bot committed Dec 31, 2024
1 parent 72459a8 commit 5b63470
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/character-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ repair_encoding <- function(code, string_is_ascii, encoding) {
if (no_repair_needed) return(code)
.cstr_pipe(
code,
sprintf("(`Encoding<-`)(\"%s\")", encoding),
sprintf("`Encoding<-`(\"%s\")", encoding),
one_liner = TRUE
)
}
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
x <- iconv("hello world", to = "latin1")
construct(x)
Output
"hello\xa0world" |> (`Encoding<-`)("latin1")
"hello\xa0world" |> `Encoding<-`("latin1")
Code
x <- iconv("こんにちは", to = "shift_jis")
construct(x)
Expand All @@ -26,5 +26,5 @@
Encoding(x) <- "latin1"
construct(x)
Output
"hello\xa0world" |> (`Encoding<-`)("latin1")
"hello\xa0world" |> `Encoding<-`("latin1")

0 comments on commit 5b63470

Please sign in to comment.