Pry doesn't treat input as UTF-8 anymore
Author: s2kCreated Jul 29, 2026Updated Jul 29, 2026
Observed Behaviour
When I enter 'ä'.encoding in pry, I get the following:
> pry
[1] pry(main)> Pry::VERSION
=> "0.16.0"
[2] pry(main)> Readline::VERSION
=> "5.2"
[3] pry(main)> RUBY_DESCRIPTION
=> "ruby 4.0.6 (2026-07-14 revision 03b6d3f889) +YJIT +PRISM [arm64-darwin25]"
[4] pry(main)> 'ä'.encoding
=> #<Encoding:BINARY (ASCII-8BIT)>Other Ruby environments
irb
In irb, I get the expected 'UTF-8':
> irb
⢀⡴⠊⢉⡟⢿ IRB v1.18.0 - Ruby 4.0.6
⣎⣀⣴⡋⡟⣻ "ls [object]" to see methods and properties
⣟⣼⣱⣽⣟⣾ ~/Library/CloudStorage/Dropbox/docs/confs-trainings-presos/tinyrubyconf_2026
irb(main):001> 'ä'.encoding
=> #<Encoding:UTF-8>Ruby script
Same in plain ruby:
> ruby -e "puts 'ä'.encoding.inspect"
#<Encoding:UTF-8>As both irb and ruby itself yield the output I expect in the same execution context (i.e. OS, terminal app), I think the issue may be with pry.
Application context
- OS: macOS Tahoe 26.6 (25G72) arm64
- Ruby: ruby 4.0.6 (2026-07-14 revision 03b6d3f889) +YJIT +PRISM [arm64-darwin25]
- pry: Pry version 0.16.0 on Ruby 4.0.6
- irb 1.18.0 (2026-04-21)
- Terminal app: iTerm 3.7.0beta8
Source: pry/pry