Bug #6820

Time#to_s on NEWS

Added by Nobuhiro IMAI over 1 year ago. Updated about 1 year ago.

[ruby-core:<unknown>]
Status:Closed
Priority:Normal
Assignee:Aaron Patterson
Category:-
Target version:2.0.0
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#tos respects Encoding.defaultinternal,
but r33094 says it is always US-ASCII. I guess NEWS file is incorrect.
See also #5226.

$ ruby -E:utf-8 -ve 'p Encoding.defaultinternal, Time.now.tos.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 about 1 year ago

updating news [Bug #6820]

History

#1 Updated by Yusuke Endoh over 1 year ago

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

Aaron, what do you think?

Yusuke Endoh mame@tsg.ne.jp

#2 Updated by Nobuhiro IMAI over 1 year ago

=begin
This is still leaving...

$ ruby -E:utf-8 -ve 'p Encoding.defaultinternal, Time.now.tos.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 about 1 year 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#tos should default to US-ASCII, but respect Encoding.defaultinternal.

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

irb(main):001:0> Encoding.defaultinternal
=> nil
irb(main):002:0> Time.now.to
s.encoding
=> #Encoding:US-ASCII
irb(main):003:0> Encoding.defaultinternal = Encoding::UTF8
=> #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 about 1 year 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#tos should default to US-ASCII, but respect Encoding.defaultinternal.

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 about 1 year 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 about 1 year 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 about 1 year 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]

Also available in: Atom PDF