From: naruse@... Date: 2017-10-21T10:29:49+00:00 Subject: [ruby-core:83441] [Ruby trunk Bug#13741][Assigned] A documentation bug of IO#putc Issue #13741 has been updated by naruse (Yui NARUSE). Status changed from Open to Assigned Assignee changed from naruse (Yui NARUSE) to shugo (Shugo Maeda) OK, could you commit it? ---------------------------------------- Bug #13741: A documentation bug of IO#putc https://bugs.ruby-lang.org/issues/13741#change-67412 * Author: shugo (Shugo Maeda) * Status: Assigned * Priority: Normal * Assignee: shugo (Shugo Maeda) * Target version: * ruby -v: * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- The documentation of IO#putc says: ``` * call-seq: * ios.putc(obj) -> obj * * If obj is Numeric, write the character whose code is * the least-significant byte of obj, otherwise write the first byte * of the string representation of obj to ios. 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 obj is Numeric, write the character whose code is * the least-significant byte of obj. * If obj is String, write the first character * of obj to ios. * Otherwise, raise TypeError. ``` 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. -- https://bugs.ruby-lang.org/ Unsubscribe: