Non-ascii caracters in package Description not displaying correctly in RStudio Help pane

We have a package with an accent in the package description (the line Description). We have solved issues with our names before adding the following line to the DESCRIPTION file:

Encoding: UTF-8

But for some odd reason this does not work now that we include an accent in the Description: portion of that file. However it may be an issue is with R Studio.

  1. We see the accent correctly in the Description column of the RStudio "Packages" pane.
  2. When we click on the package name to go the the help viewer, this is where the problem occurs: we see <c3><b3> instead of ó.

Is there something else, other than specifying the encoding that we can try? Could this be an issue in the RStudio IDE?

Hi! Perhaps this screenshot adds some relevant information to this issue...

Look, the accent on my surname, Rodríguez, is correctly shown in the Console and Files windows' bar, but incorrectly shown in Console contents.

Moreover, the accent shows correctly with getwd()...

> getwd()
[1] "C:/Users/Ricardo Rodríguez/OneDrive - Universidade de Santiago de Compostela/0000_IGFAE_Rwd"
>

Some libraries fail to install/update complaining they are not able to read the path containing the accent.

Any idea? Thanks!

1 Like

Is this in the help index page ?
If so, I encountered once this issue with French and my conclusion was that there was something of with R when generating the index file at installation. Lots of base R stuff are using the computer locale setting and the issue was my french computer on windows was not UTF8 but latin1 and the index html file generated with latin1. I did not found a solution for this page yet...

1 Like

My understanding is that it is typically recommended to use unicode escapes (e.g. \u1234) in place of multibyte characters, to ensure greater compatibility across different locales.

Hello Kevin,

We tried your solution but it didn't work. The unicode is printed not as the character we wanted but as all the characters of the unicode as the image below shows:

We tried already with the UTF-8 encoding as it is suggested in the R packages book but it's also not working for the Description line, but it does for authors.

2 Likes

I took a closer look and I believe the issue lies with R itself.

It seems that the title in the DESCRIPTION file is re-encoded when the package is installed -- for example, try executing

dcf <- read.dcf(system.file("DESCRIPTION", package = "<yourPackage>"), all = TRUE)
dcf[["Title"]]

In my case, I see the title erroneously re-encoded when there are multi-byte characters. I originally had the title field as:

Title: Buongiòrno!

but after installation, I see when attempting to read the DESCRIPTION file:

> dcf[["Title"]]
[1] "BuongiC2rno!"

and this is even when I declare Encoding: UTF-8 in the DESCRIPTION file.

2 Likes

For posterity, I filed a bug report with R: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17550

It looks like this previously worked with older versions of R, but something changed so that specifically the Title field will be converted in this way. I do not know if it is an intentional change or not.

3 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.