From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id BFDFD1F4C4 for ; Fri, 8 Nov 2024 15:49:30 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=IDY7aFpz; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=Ad5/HtYT; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1731080937; bh=tv15tFrcCvRnC8ugWp+Wdh/2QYarkQriifpov994ChI=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=IDY7aFpzQo2SRjs0vW0CGGBbL93WKp2GMscZ/kt13OqIslx1j+z8mp4iFijdXqnVF p8bCrnBDwAqKy8y06oLBo6FTCiriRkmwGcx0AprH3PI2QvZbHxOIHWjaDPPJP/WJ5u eL5BDDhCZYvLfJGHid5aLD/3WGBRwV/mEgpOGgfw= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id B338346151 for ; Fri, 8 Nov 2024 15:48:57 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=Ad5/HtYT; dkim-atps=neutral Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 1604E44B4A for ; Fri, 8 Nov 2024 15:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=pSR3opJ8YqJDEskYFXcbZh3U0zfFePNWJOvi40sQD9I=; b=Ad5/HtYTqpq/uVP9ZvR/ow2WeNVreHI4zKv5FFBg0G5uO7MKgp4Eh5oO1bZ059tu7YFW lFGkQ53E/3PLvSCheJCA8YZfEAFUaqQ9IP6R9gybER4026cuMuHw4nkATw+9LV1v/5LcXE YoxGTcF0zGKR9l3ExnRoZRt8RvHXy86SR3qYVBq3VTFjgC5+0Hckxl0SfYxLzUyJLj4UVt jPSOaqsmEvUXMYMkwnC8q1BTh8Fu5aRo3OC/t2PgMMNpqc++quTJnDm4XFaDyM9SbRKo51 4gTKCQmWkuKpopP0mIKNI1QcnRBSDnksoEB8el6mpqt23lpIR0B7OQ8TPGSDqZoQ== Received: by recvd-55fc7fd858-fl8rx with SMTP id recvd-55fc7fd858-fl8rx-1-672E3230-8 2024-11-08 15:45:52.416247239 +0000 UTC m=+4916851.115218898 Received: from herokuapp.com (unknown) by geopod-ismtpd-15 (SG) with ESMTP id T1ABL-ThT4q-lH-oPD6Whw for ; Fri, 08 Nov 2024 15:45:52.320 +0000 (UTC) Date: Fri, 08 Nov 2024 15:45:52 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 20792 X-Redmine-Issue-Author: kddnewton X-Redmine-Issue-Priority: Normal X-Redmine-Sender: kddnewton 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-Redmine-MailingListIntegration-Message-Ids: 96514 X-SG-EID: =?us-ascii?Q?u001=2E41nWPij=2FD1kdGmpgWeHScbb9X8tZePZrQQx3bl8Vy2odBuMhLMhId2kIq?= =?us-ascii?Q?I4MmMJ43lNHfKPNNds=2Fb3JsTYpYoWyQb3+sPV4d?= =?us-ascii?Q?vscaSKwkBzXGRq3UP1BALWJzRWemJM0RjjAzw=2F1?= =?us-ascii?Q?d73xedn+JuzLmRasJ5yzNYwxW5KCvoU9Tzs95W9?= =?us-ascii?Q?EEcAiqJDN0=2F4dX+eFly4oE5zfphzNeCpH8rUPHI?= =?us-ascii?Q?4oaQglgQ6zwPHy0O8Y4feAt7AzkezZbH=2FrF++gg?= =?us-ascii?Q?Qso69wPsDf3Gkbmw8dc=2FtqvQXQ=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: J6SVTTCSQYFDMLH45MSUBOVIU34YTH54 X-Message-ID-Hash: J6SVTTCSQYFDMLH45MSUBOVIU34YTH54 X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:119846] [Ruby master Feature#20792] String#with_encoding(encoding) List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "kddnewton (Kevin Newton) via ruby-core" Cc: "kddnewton (Kevin Newton)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20792 has been updated by kddnewton (Kevin Newton). Status changed from Open to Rejected In that case I think I will close this. ---------------------------------------- Feature #20792: String#with_encoding(encoding) https://bugs.ruby-lang.org/issues/20792#change-110537 * Author: kddnewton (Kevin Newton) * Status: Rejected ---------------------------------------- I would like to add a method to String called `forcible_encoding?(encoding)`. This would return true or false depending on whether the receiver can be forced into the given encoding without breaking the string. It would effectively be an alias for: ```ruby def forcible_encoding?(enc) original = encoding result = force_encoding(enc).valid_encoding? force_encoding(original) result end ``` I would like this method because there are extremely rare but possible circumstances where source files are marked as binary but contain UTF-8-encoded characters. In that case I would like to check if it's possible to cleanly force UTF-8 before actually doing it. The code I'm trying to replace is here: https://github.com/ruby/prism/blob/d6e9b8de36b4d18debfe36e4545116539964ceeb/lib/prism/parse_result.rb#L15-L30. The pull request for the code is here: https://github.com/ruby/ruby/pull/11851. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/