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.
Actions
Like0
Like0Like0