Очистка нераспознанных символов из редактора RStudio (точка с розовым фоном) программно - PullRequest
0 голосов
/ 13 января 2019

Я хочу удалить нераспознанные (не декодированные) символы из RStudio pro грамматически. Использование функции iconv не работает должным образом. Как я могу решить проблему, показанную на картинке ниже?

enter image description here

Нераспознанный текст RStudio в моем редакторе:

Это текст, который не может быть декодирован в RStudio стр. 10–11) Pub

Код выше:

text <- readClipboard()
rstudioapi::insertText(text) # Insert the text to the editor
# This is how it looks like
"This is a text that cannot be decoded in RStudio: pp. 10–11: "

# If I change the encoding:
text <- iconv(text, "UTF-8", "UTF-8", sub='')
# Output that I get is without "–" as well:
rstudioapi::insertText(text)
"This is a text that cannot be decoded in RStudio: pp.1011: " # Output without "-"

# This is what I want is just to remove dot with pink character:
rstudioapi::insertText(text)
"This is a text that cannot be decoded in RStudio: pp.10–11: "
...