[#102393] [Ruby master Feature#17608] Compact and sum in one step — sawadatsuyoshi@...

Issue #17608 has been reported by sawa (Tsuyoshi Sawada).

13 messages 2021/02/04

[#102438] [Ruby master Bug#17619] if false foo=42; end creates a foo local variable set to nil — pkmuldoon@...

Issue #17619 has been reported by pkmuldoon (Phil Muldoon).

10 messages 2021/02/10

[#102631] [Ruby master Feature#17660] Expose information about which basic methods have been redefined — tenderlove@...

Issue #17660 has been reported by tenderlovemaking (Aaron Patterson).

9 messages 2021/02/27

[#102639] [Ruby master Misc#17662] The herdoc pattern used in tests does not syntax highlight correctly in many editors — eregontp@...

Issue #17662 has been reported by Eregon (Benoit Daloze).

13 messages 2021/02/27

[#102652] [Ruby master Bug#17664] Behavior of sockets changed in Ruby 3.0 to non-blocking — ciconia@...

Issue #17664 has been reported by ciconia (Sharon Rosner).

23 messages 2021/02/28

[ruby-core:102626] [Ruby master Bug#9016] String#encoding is lying?

From: merch-redmine@...
Date: 2021-02-26 22:21:13 UTC
List: ruby-core #102626
Issue #9016 has been updated by jeremyevans0 (Jeremy Evans).

Backport deleted (1.9.3: UNKNOWN, 2.0.0: UNKNOWN)
Status changed from Feedback to Closed

As Ruby 3.0 uses UTF-8 for ARGV, this is fixed.

With modified example:

```ruby
puts "Encoding of argument is reported as #{ARGV[0].encoding} and as #{ARGV[0].valid_encoding? ? "valid" : "invalid"}."
puts "Let us inspect the a-tilde argument: #{ARGV[0].dump}"
puts "Let us inspect the a-tilde from UTF-8 source code transcoded into CP850: #{"磚.encode("CP850").dump}"
puts "Let us inspect the a-tilde from UTF-8 source code transcoded into ISO-8859-1: #{"磚.encode("ISO-8859-1").dump}"
```

output is:

```
ruby t.rb 
Encoding of argument is reported as UTF-8 and as valid.
Let us inspect the a-tilde argument: "\u00E3"
Let us inspect the a-tilde from UTF-8 source code transcoded into CP850: "\xC6"
Let us inspect the a-tilde from UTF-8 source code transcoded into ISO-8859-1: "\xE3"
```

----------------------------------------
Bug #9016: String#encoding is lying?
https://bugs.ruby-lang.org/issues/9016#change-90620

* Author: renatosilva (Renato Silva)
* Status: Closed
* Priority: Normal
* Assignee: cruby-windows
* ruby -v: ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
----------------------------------------
Please see attached test case.

If you try opening a file using a CP850 (possibly others) path which was passed as command line argument, you are not able at all, unless you encode the argument into its very own reported encoding (CP850), and from some encoding different than that (in my case, both ISO-8859-1 and Windows-1252 worked). It is just like ARGV[0].encoding is lying!

Before, in Ruby 1.8, File.open would work just fine. I have a script that just stopped working, till I found the above workaround. This seems to me like a bug. I would expect Ruby to just do its best in order to convert user input into the required encodings for file APIs and such. Meaning I would not like for a possible fix to require any code migration from 1.8 to 1.9+ at all.

---Files--------------------------------
encoding-lying.rb (1.04 KB)
encoding-lying-reduced.rb (761 Bytes)


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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next