Skip to content

encoding of strings passed to R RPC methods should be marked as UTF-8 #8445

Open

Description

@kevinushey

For example, we commonly do this:

# The contents are always passed as UTF-8 from the client and
# we want to make sure this is preserved on disk. Note that
# when the source command is issued by the client for
# "~/active-rstudio-document" UTF-8 is specified explicitly
# (see TextEditingTarget.sourceActiveDocument)
Encoding(contents) <- "UTF-8"
writeLines(contents, activeRStudioDoc, useBytes = TRUE)

However, given that strings passed to R RPC methods are (almost) always UTF-8, we should consider just creating + marking them that way when we find and invoke the RPC.

There are some places where we manually invoke RPCs as regular functions, e.g.

.rs.rpc.copy_profile(profilerOptions$fileName, htmlFile)

so such usages would need to be checked as well.

Activity

  1. added
    tech debt
    on Nov 20, 2020
  2. kevinushey commented on Nov 20, 2020

    @kevinushey
    CollaboratorAuthor

    so such usages would need to be checked as well.

    This is actually not relevant. The issue with RPC methods as called by RStudio is that we pass in UTF-8 data, but fail to mark the encoding as UTF-8. In other usages, we may have strings in the native encoding, or UTF-8 -- but regardless, the encoding is correctly marked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech debt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions