From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id ED67F1960070 for ; Thu, 2 Jul 2015 16:54:57 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id C3E7FB5D8ED for ; Thu, 2 Jul 2015 17:20:40 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id C56DC97A839 for ; Thu, 2 Jul 2015 17:20:42 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Authentication-Results: funfun.nagaokaut.ac.jp (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=sendgrid.me Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T0PGVb8-yofg for ; Thu, 2 Jul 2015 17:20:42 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 8A05397A838 for ; Thu, 2 Jul 2015 17:20:42 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 772D795243E for ; Thu, 2 Jul 2015 17:20:40 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 591EB12048F; Thu, 2 Jul 2015 17:20:39 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 713A5120464 for ; Thu, 2 Jul 2015 17:20:36 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=fp4uf5aEg9aLZVCrRu4lDlF7hI8=; b=lrF7xZmq8bZHbLEEjO rfIdS8/g3diVULTCDSkKXwScEA9FWT/OvTHFpOwi+XKMNk1WSbQ6lxAMIbCzmEeZ 0od8OtywkV7Jz7Q0+yndaO8wd+TmTZhVFshHUkXqSubj7hGa1JKAkRnKxvxmjaKp IyCEY0Wkj6TSS47uDkcDPjEwo= Received: by filter0461p1mdw1.sendgrid.net with SMTP id filter0461p1mdw1.22521.5594F4505 2015-07-02 08:20:32.204941273 +0000 UTC Received: from herokuapp.com (ec2-54-146-249-205.compute-1.amazonaws.com [54.146.249.205]) by ismtpd-035 (SG) with ESMTP id 14e4dda5859.117d.50ab59 for ; Thu, 02 Jul 2015 08:20:31 +0000 (UTC) Date: Thu, 02 Jul 2015 08:20:31 +0000 From: redmine.ruby-lang.org@2238club.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 44439 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11324 X-Redmine-Issue-Author: sakuro X-Redmine-Sender: sakuro X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS6bG89zowLwC6ZT6qAmi8mc51ENPc8qXLJ+YI yvrOl54AEAsODrrtX3tCZ/obYtngt4u2ZlmPAWWKqjZX9kfH2FB8EQ1I/uIssoZluBDNw+klrd6rng 4g/vj2OFjld1TWfO/cF19AeHM1wLn1sZFgfu X-ML-Name: ruby-core X-Mail-Count: 69841 Subject: [ruby-core:69841] [Ruby trunk - Bug #11324] [Open] Encoding to a String's own encoding with some options fails X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11324 has been reported by Sakuro OZAWA. ---------------------------------------- Bug #11324: Encoding to a String's own encoding with some options fails https://bugs.ruby-lang.org/issues/11324 * Author: Sakuro OZAWA * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- To encode a `String` instance to its own encoding seems to be a bad idea, but following result looks strange: ```ruby s = "A\nB\r\nC".force_encoding('US-ASCII') #=> "A\nB\r\nC" s.encode('US-ASCII') #=> "A\nB\r\nC" s.encode('US-ASCII', universal_newline: true) #=> "A\nB\nC" s.encode('US-ASCII', universal_newline: true, undef: :replace) #=> "A\nB\nC" s.encode('US-ASCII', universal_newline: true, undef: :replace, replace: '') # Encoding::ConverterNotFoundError: code converter not found (universal_newline) ``` Only when all of these three options are fed, `String#encode` fails and provided message shows unclear encoding name. -- https://bugs.ruby-lang.org/