Actions
Bug #13741
closedA documentation bug of IO#putc
Description
The documentation of IO#putc says:
* call-seq:
* ios.putc(obj) -> obj
*
* If <i>obj</i> is <code>Numeric</code>, write the character whose code is
* the least-significant byte of <i>obj</i>, otherwise write the first byte
* of the string representation of <i>obj</i> to <em>ios</em>. Note: This
* method is not safe for use with multi-byte characters as it will truncate
* them.
However, it supports multi-byte characters in the string argument form
since r29447:
$ ruby -e 'putc "あいうえお"'
あ
How about to change the documentation?
* If <i>obj</i> is <code>Numeric</code>, write the character whose code is
* the least-significant byte of <i>obj</i>.
* If <i>obj</i> is <code>String</code>, write the first character
* of <i>obj</i> to <em>ios</em>.
* Otherwise, raise <code>TypeError</code>.
It may be better to change the behavior of the numeric argument form
to support multi-byte characters if ios has encoding
information, but it's a different issue.
Updated by naruse (Yui NARUSE) almost 7 years ago
- Status changed from Open to Assigned
- Assignee changed from naruse (Yui NARUSE) to shugo (Shugo Maeda)
OK, could you commit it?
Updated by shugo (Shugo Maeda) over 6 years ago
- Status changed from Assigned to Closed
Applied in changeset trunk|r60991.
Fix a documentation error of IO#putc.
IO#putc is multi-byte character safe when a String is given as its argument.
[ruby-core:82019] [Bug #13741]
Actions
Like0
Like0Like0