pry-rails
pry-rails copied to clipboard
Unicode problems in console
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 (andSTDIN.external_encodinggives#<Encoding:UTF-8>) - Starting
rails cwithout thepry-railsgem (irb console): unicode works. - Starting
pry -r ./config/environmentfails 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).
Seems to be a problem with bundler and pry. Minimal setup:
mkdir testenc
cd testenc
touch Gemfile
bundler exec pry
→same problem as described above (tried different bundler versions). Still no idea :-)