Students commonly paste assignment questions from a pdf or word document into Rmarkdown. However, the pasted text often has non-ascii characters for bullets, quotes, etc. I have used `gsub` in the past as part of a function to replace such characters and that seemed to work fine but I'm running into problems now again.

The first line in each pair shown below works on macOS, Linux, and Windows. However, non-ascii characters are not allowed in code to be included in an R package. The 2nd line in each pair works on macOS and Linux but not on Windows.

It would be great to have a general approach to deal with these type of characters that does not involve simply deleting them.

```
gsub("•", "*", "A big dot •")
gsub("\xE2\x80\xA2", "*", "A big dot •")

gsub("…", "...", "Some small dots …")
gsub("\xE2\x80\xA6", "...", "Some small dots …")

gsub("–", "-", "A long-dash –")
gsub("\xE2\x80\x93", "-", "A long-dash –")

gsub("’", "'", "A curly single quote ’")
gsub("\xE2\x80\x99", "'", "A curly single quote ’")

gsub("‘", "'", "A curly single quote ‘")
gsub("\xE2\x80\x98", "'", "A curly single quote ‘")

gsub("”", '"', "A curly double quote ”")
gsub("\xE2\x80\x9D", '"', "A curly double quote ”")

gsub("“", '"', "A curly double quote “")
gsub("\xE2\x80\x9C", '"', "A curly double quote “")

```