From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_PASS,T_RP_MATCHES_RCVD shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 6784F1F404 for ; Sun, 4 Mar 2018 02:06:09 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A4230120913; Sun, 4 Mar 2018 11:06:06 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 690AD1208FF for ; Sun, 4 Mar 2018 11:06:02 +0900 (JST) Received: by filter0017p3iad2.sendgrid.net with SMTP id filter0017p3iad2-31166-5A9B5486-D 2018-03-04 02:05:58.294055113 +0000 UTC Received: from herokuapp.com (ec2-54-224-8-232.compute-1.amazonaws.com [54.224.8.232]) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id fmaWnpWAQ4idaHiNbSHY5Q for ; Sun, 04 Mar 2018 02:05:58.215 +0000 (UTC) Date: Sun, 04 Mar 2018 02:05:58 +0000 (UTC) From: pumburu@ya.ru To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 61235 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 14574 X-Redmine-Issue-Author: pb X-Redmine-Sender: pb 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS5D+CDKjXiHvmWuAU8HkOU6aCIqty1lX8Zbmv 43Vuz/GzV4jaaL+1d2SjC/ub0maWhoNo2WD4csnSOUyWOQbCtPHmpXgk5bKxi8P0og27iuPeOIYXk1 ramTwfnHac/6EN4dKV4nAWEx/PfoYaWW0vaO X-ML-Name: ruby-core X-Mail-Count: 85913 Subject: [ruby-core:85913] [Ruby trunk Feature#14574] percent literals and binary encoding strings 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #14574 has been reported by pb (pumbur _). ---------------------------------------- Feature #14574: percent literals and binary encoding strings https://bugs.ruby-lang.org/issues/14574 * Author: pb (pumbur _) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- coding `"\x00".force_encoding('binary')` or `["\x00"].pack('a*')` is a hassle, is there a chance to have special percent literal for it? i.e: `%b"\x00"` would return binary string. (note, signle-character \x00 there is accidental, the idea is force any string from script encoding to binary) or, more general suggestion: allow percent literal with any [a-z] character, move all logic to user-level and allow it to be redefinable: ~~~ ruby define_percent_literal(:b){|q| q.force_encoding('binary') } %b'\x00' #=> "\x00" ~~~ -- https://bugs.ruby-lang.org/