Project

General

Profile

Actions

Bug #6820

closed

Time#to_s on NEWS

Added by no6v (Nobuhiro IMAI) over 12 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.0.0dev (2012-08-01 trunk 36587) [x86_64-linux]
Backport:
[ruby-core:<unknown>]

Description

=begin
The Time section on NEWS file says an encoding of Time#to_s respects Encoding.default_internal,
but r33094 says it is always US-ASCII. I guess NEWS file is incorrect.
See also #5226.

$ ruby -E:utf-8 -ve 'p Encoding.default_internal, Time.now.to_s.encoding'
ruby 2.0.0dev (2012-08-01 trunk 36587) [x86_64-linux]
#Encoding:UTF-8
#Encoding:US-ASCII
=end


Files

Time-on-NEWS.patch (914 Bytes) Time-on-NEWS.patch no6v (Nobuhiro IMAI), 01/06/2013 11:20 AM

Updated by mame (Yusuke Endoh) about 12 years ago

  • Status changed from Open to Assigned
  • Assignee set to tenderlovemaking (Aaron Patterson)
  • Target version set to 2.0.0

Aaron, what do you think?

--
Yusuke Endoh

Updated by no6v (Nobuhiro IMAI) almost 12 years ago

=begin
This is still leaving...

$ ruby -E:utf-8 -ve 'p Encoding.default_internal, Time.now.to_s.encoding'
ruby 2.0.0dev (2013-01-06 trunk 38711) [x86_64-linux]
#Encoding:UTF-8
#Encoding:US-ASCII

I attached a patch to drop whole section of Time. Would you confirm that?
=end

Updated by zzak (zzak _) almost 12 years ago

I think this is a bug on Time#to_s, not NEWS.

From #5226:
tenderlovemaking (Aaron Patterson) wrote:

I think the encoding of Time#to_s should default to US-ASCII, but respect Encoding.default_internal.

I've attached a patch to make Time#to_s respect Encoding.default_internal. The result is:

irb(main):001:0> Encoding.default_internal
=> nil
irb(main):002:0> Time.now.to_s.encoding
=> #Encoding:US-ASCII
irb(main):003:0> Encoding.default_internal = Encoding::UTF_8
=> #Encoding:UTF-8
irb(main):004:0> Time.now.to_s.encoding
=> #Encoding:UTF-8
irb(main):005:0>

Can we change description?

Updated by no6v (Nobuhiro IMAI) almost 12 years ago

I think this is a bug on Time#to_s, not NEWS.

From #5226:
tenderlovemaking (Aaron Patterson) wrote:

I think the encoding of Time#to_s should default to US-ASCII, but respect Encoding.default_internal.

It seems that Naruse-san didn't implement so on this point at r33094 explicitly.

* time.c (time_to_s): the resulted string of Time#to_s is always
  ascii only, so this should be US-ASCII.

Updated by zzak (zzak _) almost 12 years ago

=begin
Thank you for finding that revision Nobuhiro-san, I must have missed it.

I think NEWS should say simply:
(({Time#to_s now returns US-ASCII encoding instead of BINARY}))
=end

Updated by no6v (Nobuhiro IMAI) almost 12 years ago

I think NEWS should say simply:
(({Time#to_s now returns US-ASCII encoding instead of BINARY}))

@zzak (zzak _) Sounds good. I've been misunderstood as nothing has changed, thanks :).

Actions #7

Updated by tenderlovemaking (Aaron Patterson) almost 12 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38944.
Nobuhiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


updating news [Bug #6820]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0