Skip to content

Unicode problems in console #124

@Lapizistik

Description

@Lapizistik

Problem

With pry-rails in the Gemfile starting rails c (or bundle exec rails c) gives a pry console.
Typing some unicode character (outside the ASCII range) show incorrect results (i.e. the byte sequence) on the console:
ää,
éé,
â¬,
â¢,

STDIN.external_encoding gives nil

This behaviour started some weeks before, I could not exactly figure out with which version of pry or pry-rails. It worked before with the same rails versions.

Setup

  • Debian 11 (bullseye)
  • ruby 2.7.4p191
  • Rails 6.1.4.1 (and Rails 6.0.3.2)
  • no ~/.pryrc
  • LANG=de_DE.UTF-8

Running rails new testenc and adding pry-rails to the Gemfile (see Gemfile.zip for Gemfile and Gemfile.lock)

Things I tested

  • Starting pry (without rails) works (and STDIN.external_encoding gives #<Encoding:UTF-8>)
  • Starting rails c without the pry-rails gem (irb console): unicode works.
  • Starting pry -r ./config/environment fails with unicode problems (as described)

Changing LANG

spring stop; LANG=C rails c: now typing ä or or any other non-ASCII character shows no echo at all.
But: if spring is still running from before (i.e. without the spring stop) the LANG change has no effect.

No history

Starting pry gives me the history from last time. This also stopped working for pry rails (the history file is not loaded), at the same time (can file a separate issue for this but could also be related).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions