From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 571EE1F461 for ; Wed, 15 May 2019 23:24:48 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 62B06120A56; Thu, 16 May 2019 08:24:42 +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 EE4AF120A56 for ; Thu, 16 May 2019 08:24:39 +0900 (JST) Received: by filter0092p3las1.sendgrid.net with SMTP id filter0092p3las1-18427-5CDC9FB8-30 2019-05-15 23:24:40.947374288 +0000 UTC m=+2738.876622251 Received: from herokuapp.com (unknown [34.228.185.226]) by ismtpd0065p1mdw1.sendgrid.net (SG) with ESMTP id JRxwMypOTDyyz9aSMjSl5w for ; Wed, 15 May 2019 23:24:40.902 +0000 (UTC) Date: Wed, 15 May 2019 23:24:41 +0000 (UTC) From: merch-redmine@jeremyevans.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 68156 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15839 X-Redmine-Issue-Author: nobu X-Redmine-Sender: jeremyevans0 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: =?us-ascii?Q?RVE3t853K5scBhbmJHUzZTFFeVC=2FZSUmHZ0Dc+26wcEi2CTgsF1oz0wTSSxGGN?= =?us-ascii?Q?BIqpGbVev6y5GBpLyY6+oFSv51KhxeQkB=2FcBFSg?= =?us-ascii?Q?iueueEUm2UozGampv0FLw0H=2FCbD95IdnM5JvuLd?= =?us-ascii?Q?K0Wvj5eyeZvfb6Bfe1j8dRV4q0bciBdzHS6yE=2F=2F?= =?us-ascii?Q?xgZ4mgME4PoDx3bC1Z3q+VyM=2Fz550jcK=2Fxw=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92673 Subject: [ruby-core:92673] [Ruby trunk Bug#15839] mixed encoding heredoc should be a syntax error regardless the order 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 #15839 has been updated by jeremyevans0 (Jeremy Evans). File mixed-encoding-heredoc-fix-v2.patch added After additional analysis, I found that I only needed to add one line to my initial patch to fix it to work with both `\u` before `\x` and `\u` after `\x`. With the attached patch (which supersedes the previous patches): ``` $ ruby -e '#encoding: cp932 p((<<-STR)) \u1234 \xe9\x9d STR ' -e:4: UTF-8 mixed within Windows-31J source \xe9\x9d $ ruby -e '#encoding: cp932 p((<<-STR)) \xe9\x9d \u1234 STR ' -e:4: UTF-8 mixed within Windows-31J source \u1234 -e:2: syntax error, unexpected end-of-input, expecting literal content or terminator or tSTRING_DBEG or tSTRING_DVAR ``` ---------------------------------------- Bug #15839: mixed encoding heredoc should be a syntax error regardless the order https://bugs.ruby-lang.org/issues/15839#change-78036 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.4: REQUIRED, 2.5: REQUIRED, 2.6: REQUIRED ---------------------------------------- This heredoc isn't a syntax error, ```ruby #encoding: cp932 p <<-STR \xe9\x9d \u1234 STR ``` whereas this is. ```ruby #encoding: cp932 " \xe9\x9d \u1234 " ``` ---Files-------------------------------- mixed-encoding-heredoc-fix.patch (5.28 KB) mixed-encoding-heredoc-reverse-order-fix.patch (1.58 KB) mixed-encoding-heredoc-fix-v2.patch (5.64 KB) -- https://bugs.ruby-lang.org/