Bug #6820

Time#to_s on NEWS

Added by Nobuhiro IMAI about 3 years ago. Updated over 2 years ago.

[ruby-core:<unknown>]
Status:Closed
Priority:Normal
Assignee:Aaron Patterson
ruby -v:ruby 2.0.0dev (2012-08-01 trunk 36587) [x86_64-linux] Backport:

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

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

Associated revisions

Revision 38944
Added by tenderlove over 2 years ago

updating news [Bug #6820]

Revision 38944
Added by tenderlove over 2 years ago

updating news [Bug #6820]

History

#1 Updated by Yusuke Endoh almost 3 years ago

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

Aaron, what do you think?

Yusuke Endoh mame@tsg.ne.jp

#2 Updated by Nobuhiro IMAI over 2 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

#3 Updated by Zachary Scott over 2 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?

#4 Updated by Nobuhiro IMAI over 2 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.

#5 Updated by Zachary Scott over 2 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

#6 Updated by Nobuhiro IMAI over 2 years ago

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

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

#7 Updated by Aaron Patterson over 2 years ago

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

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]

Also available in: Atom PDF