Problem with kable() function

Hi everyone, I hope you are well,

Sometimes when I use the function kable() I get the next error:

Error in gsub(""", "\"", string, fixed = TRUE) : input string 2 is invalid UTF-8

For example, this time I did:

kable(head(mydataset))

I tried to reopen changin the encoding and saving changin the encoding but it still continue. Some people told me that this error is common if you copy a piece of code, but in this time I wrote my whole RMarkdown, so I don´t know what can I do.

Thanks mates!

Any solutions? I have the same problem but the Markdown is still being done. The problem is that i cant see the table under the code chunk after running it.

Hi, welcome to the forum.
We need a reproducible example (reprex)
FAQ: How to do a minimal reproducible example ( reprex ) for beginners .

Given that it seems a coding problem can you give us the output of sessionInfo() as well