Skip to content

Incorrect handling of multiple-byte characters in double-quote string literal Rubocop quickfix #4094

Description

@pauljunova

Description

Performing a quickfix on a single-quoted string literal, when a rubocop rule preferring double-quotes is active, outputs a double-quoted string with utf-8 content garbled.

Ruby LSP Information

neovim:

NVIM v0.12.3-dev-53+g0aa77cb78c
Build type: RelWithDebInfo
LuaJIT 2.1.1774638290

ruby:

ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux]

ruby-lsp: tested on 0.26.9 and 0.27.0.beta2

Reproduction steps

  • Setup rubocop in project with this rule
Style/StringLiterals:
  EnforcedStyle: single_quotes
  • Write a single quoted string containing multi-byte unicode characters
  • Perform quickfix
  • Unicode escape sequence is added and the last single-quote is not removed
recording.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpinnedThis issue or pull request is pinned and won't be marked as stale

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions