ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:101954] [Ruby master Bug#17517] File.expand_path returns us-aascii when both arguments are ascii compat
@ 2021-01-06 11:32 zn
  2021-01-06 12:49 ` [ruby-core:101957] " jean.boussier
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zn @ 2021-01-06 11:32 UTC (permalink / raw)
  To: ruby-core

Issue #17517 has been reported by znz (Kazuhiro NISHIYAMA).

----------------------------------------
Bug #17517: File.expand_path returns us-aascii when both arguments are ascii compat
https://bugs.ruby-lang.org/issues/17517

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Is this intentional?

```ruby
p __dir__.encoding  #=> #<Encoding:UTF-8>
p 'hoge'.encoding   #=> #<Encoding:UTF-8>
p File.expand_path('hoge', __dir__).encoding #=> #<Encoding:US-ASCII>
```

```
% docker run -it --rm ghcr.io/ruby/all-ruby env ALL_RUBY_SINCE=ruby-1.9 ./all-ruby -e 'p File.expand_path("hoge".encode("utf-8"), "/".encode("utf-8")).encoding'
ruby-1.9.0-0        -e:1:in `encode': transcoding not supported (from ASCII-8BIT to UTF-8) (ArgumentError)
                    	from -e:1:in `<main>'
                exit 1
ruby-1.9.0-1        #<Encoding:ASCII-8BIT>
ruby-1.9.0-2        #<Encoding:US-ASCII>
...
ruby-1.9.1-p129     #<Encoding:US-ASCII>
ruby-1.9.1-p243     #<Encoding:UTF-8>
...
ruby-1.9.2-preview1 #<Encoding:UTF-8>
ruby-1.9.2-preview3 #<Encoding:US-ASCII>
...
ruby-3.0.0          #<Encoding:US-ASCII>
```



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-13 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 11:32 [ruby-core:101954] [Ruby master Bug#17517] File.expand_path returns us-aascii when both arguments are ascii compat zn
2021-01-06 12:49 ` [ruby-core:101957] " jean.boussier
2021-01-07  4:39 ` [ruby-core:101969] [Ruby master Bug#17517] File.expand_path returns us-ascii " duerst
2021-01-12  0:50 ` [ruby-core:102006] " zn
2021-01-13 15:19 ` [ruby-core:102062] " nobu

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).