* [ruby-core:106174] [Ruby master Bug#18350] String with foreign character results in: TypeError (nil can't be coerced into Integer)
@ 2021-11-19 18:35 diadbrown (Dave Brown)
2021-11-19 19:33 ` [ruby-core:106176] " jeremyevans0 (Jeremy Evans)
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: diadbrown (Dave Brown) @ 2021-11-19 18:35 UTC (permalink / raw
To: ruby-core
Issue #18350 has been reported by diadbrown (Dave Brown).
----------------------------------------
Bug #18350: String with foreign character results in: TypeError (nil can't be coerced into Integer)
https://bugs.ruby-lang.org/issues/18350
* Author: diadbrown (Dave Brown)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin17]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
``` ruby
2.7.2 :001 > s = "Púrpura"
Traceback (most recent call last):
7: from /Users/xxx/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `<main>'
6: from /Users/xxx/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `load'
5: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
4: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:99:in `calculate_width'
3: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:99:in `scan'
2: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:108:in `block in calculate_width'
1: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:108:in `+'
TypeError (nil can't be coerced into Integer)
2.7.2 :002 >
```
Ruby 2.6.3 does not have this problem:
``` ruby
2.6.3 :001 > s = "Púrpura"
=> "Púrpura"
2.6.3 :002 >
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:106176] [Ruby master Bug#18350] String with foreign character results in: TypeError (nil can't be coerced into Integer)
2021-11-19 18:35 [ruby-core:106174] [Ruby master Bug#18350] String with foreign character results in: TypeError (nil can't be coerced into Integer) diadbrown (Dave Brown)
@ 2021-11-19 19:33 ` jeremyevans0 (Jeremy Evans)
2021-11-22 14:29 ` [ruby-core:106209] " diadbrown (Dave Brown)
2021-11-22 16:57 ` [ruby-core:106211] " diadbrown (Dave Brown)
2 siblings, 0 replies; 4+ messages in thread
From: jeremyevans0 (Jeremy Evans) @ 2021-11-19 19:33 UTC (permalink / raw
To: ruby-core
Issue #18350 has been updated by jeremyevans0 (Jeremy Evans).
I cannot reproduce this on Windows using the default 437 code page (using Ruby 2.7.0) or on OpenBSD (using Ruby 2.7.4):
```
C:\Ruby27-x64\bin>chcp
Active code page: 437
C:\Ruby27-x64\bin>set RUBYOPT=-Ku
C:\Ruby27-x64\bin>irb
irb(main):001:0> s = "Púrpura"
irb(main):002:0> s
=> "Púrpura"
irb(main):003:0> RUBY_VERSION
=> "2.7.0"
```
```
$ RUBYOPT=-Ku irb27
irb(main):001:0> s = "Púrpura"
=> "Púrpura"
irb(main):002:0> RUBY_VERSION
=> "2.7.4"
```
When I try it on Windows with the 65001 (UTF-8) code page, the entire command prompt window containing irb closes (not just the ruby process). I also tried with Ruby 3.0 and got the same result. I can paste the `s = "Púrpura"` text directly into the command prompt outside of irb, so it doesn't appear to be purely a Windows command prompt issue.
You appear to be running on Mac, so the situation must be different there. Can you reproduce this issue with Ruby 3.0?
----------------------------------------
Bug #18350: String with foreign character results in: TypeError (nil can't be coerced into Integer)
https://bugs.ruby-lang.org/issues/18350#change-94780
* Author: diadbrown (Dave Brown)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin17]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
``` ruby
2.7.2 :001 > s = "Púrpura"
Traceback (most recent call last):
7: from /Users/xxx/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `<main>'
6: from /Users/xxx/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `load'
5: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
4: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:99:in `calculate_width'
3: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:99:in `scan'
2: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:108:in `block in calculate_width'
1: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:108:in `+'
TypeError (nil can't be coerced into Integer)
2.7.2 :002 >
```
Ruby 2.6.3 does not have this problem:
``` ruby
2.6.3 :001 > s = "Púrpura"
=> "Púrpura"
2.6.3 :002 >
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:106209] [Ruby master Bug#18350] String with foreign character results in: TypeError (nil can't be coerced into Integer)
2021-11-19 18:35 [ruby-core:106174] [Ruby master Bug#18350] String with foreign character results in: TypeError (nil can't be coerced into Integer) diadbrown (Dave Brown)
2021-11-19 19:33 ` [ruby-core:106176] " jeremyevans0 (Jeremy Evans)
@ 2021-11-22 14:29 ` diadbrown (Dave Brown)
2021-11-22 16:57 ` [ruby-core:106211] " diadbrown (Dave Brown)
2 siblings, 0 replies; 4+ messages in thread
From: diadbrown (Dave Brown) @ 2021-11-22 14:29 UTC (permalink / raw
To: ruby-core
Issue #18350 has been updated by diadbrown (Dave Brown).
@jeremyevans0 I don't have 3.0.0 here, and since my Mac is somewhat old I can't get it to install. Maybe someone else on Mac with 3.0.0 can try?
jeremyevans0 (Jeremy Evans) wrote in #note-1:
> I cannot reproduce this on Windows using the default 437 code page (using Ruby 2.7.0) or on OpenBSD (using Ruby 2.7.4):
>
> ```
> C:\Ruby27-x64\bin>chcp
> Active code page: 437
>
> C:\Ruby27-x64\bin>set RUBYOPT=-Ku
>
> C:\Ruby27-x64\bin>irb
> irb(main):001:0> s = "Púrpura"
> irb(main):002:0> s
> => "Púrpura"
> irb(main):003:0> RUBY_VERSION
> => "2.7.0"
> ```
>
> ```
> $ RUBYOPT=-Ku irb27
> irb(main):001:0> s = "Púrpura"
> => "Púrpura"
> irb(main):002:0> RUBY_VERSION
> => "2.7.4"
> ```
>
> When I try it on Windows with the 65001 (UTF-8) code page, the entire command prompt window containing irb closes (not just the ruby process). I also tried with Ruby 3.0 and got the same result. I can paste the `s = "Púrpura"` text directly into the command prompt outside of irb, so it doesn't appear to be purely a Windows command prompt issue.
>
> You appear to be running on Mac, so the situation must be different there. Can you reproduce this issue with Ruby 3.0?
----------------------------------------
Bug #18350: String with foreign character results in: TypeError (nil can't be coerced into Integer)
https://bugs.ruby-lang.org/issues/18350#change-94817
* Author: diadbrown (Dave Brown)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin17]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
``` ruby
2.7.2 :001 > s = "Púrpura"
Traceback (most recent call last):
7: from /Users/xxx/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `<main>'
6: from /Users/xxx/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `load'
5: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
4: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:99:in `calculate_width'
3: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:99:in `scan'
2: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:108:in `block in calculate_width'
1: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:108:in `+'
TypeError (nil can't be coerced into Integer)
2.7.2 :002 >
```
Ruby 2.6.3 does not have this problem:
``` ruby
2.6.3 :001 > s = "Púrpura"
=> "Púrpura"
2.6.3 :002 >
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:106211] [Ruby master Bug#18350] String with foreign character results in: TypeError (nil can't be coerced into Integer)
2021-11-19 18:35 [ruby-core:106174] [Ruby master Bug#18350] String with foreign character results in: TypeError (nil can't be coerced into Integer) diadbrown (Dave Brown)
2021-11-19 19:33 ` [ruby-core:106176] " jeremyevans0 (Jeremy Evans)
2021-11-22 14:29 ` [ruby-core:106209] " diadbrown (Dave Brown)
@ 2021-11-22 16:57 ` diadbrown (Dave Brown)
2 siblings, 0 replies; 4+ messages in thread
From: diadbrown (Dave Brown) @ 2021-11-22 16:57 UTC (permalink / raw
To: ruby-core
Issue #18350 has been updated by diadbrown (Dave Brown).
@jeremyevans0 I found the issue: https://github.com/ruby/irb/issues/261
This fixed it.
----------------------------------------
Bug #18350: String with foreign character results in: TypeError (nil can't be coerced into Integer)
https://bugs.ruby-lang.org/issues/18350#change-94819
* Author: diadbrown (Dave Brown)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin17]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
``` ruby
2.7.2 :001 > s = "Púrpura"
Traceback (most recent call last):
7: from /Users/xxx/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `<main>'
6: from /Users/xxx/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `load'
5: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
4: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:99:in `calculate_width'
3: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:99:in `scan'
2: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:108:in `block in calculate_width'
1: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/reline/unicode.rb:108:in `+'
TypeError (nil can't be coerced into Integer)
2.7.2 :002 >
```
Ruby 2.6.3 does not have this problem:
``` ruby
2.6.3 :001 > s = "Púrpura"
=> "Púrpura"
2.6.3 :002 >
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-22 16:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-19 18:35 [ruby-core:106174] [Ruby master Bug#18350] String with foreign character results in: TypeError (nil can't be coerced into Integer) diadbrown (Dave Brown)
2021-11-19 19:33 ` [ruby-core:106176] " jeremyevans0 (Jeremy Evans)
2021-11-22 14:29 ` [ruby-core:106209] " diadbrown (Dave Brown)
2021-11-22 16:57 ` [ruby-core:106211] " diadbrown (Dave Brown)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).