Skip to content

Consistent handling of Encoding #752

@AshesITR

Description

@AshesITR

Currently, we use readLines() when linting, which assumes the system encoding when parsing files.

This results in uncovered lines w.r.t. fixing column numbers of UTF-8 Multibyte characters (at least on Windows, cf. #739) and in bugs when the file encoding doesn't match the system encoding (cf. #541)

lintr should

  • get a new setting encoding with a smart default (see below) overridable in the usual ways.
  • respect this setting in get_source_expressions()
  • Update the tests to force UTF-8 encoding where necessary

The smart default for encoding should pick the first valid option of this list:

  1. The Encoding field in a package DESCRIPTION
  2. The Encoding field from the .Rproj file in a project directory
  3. UTF-8

This default is system-independent and thus should be safe to use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions