From: merch-redmine@... Date: 2019-05-15T15:24:13+00:00 Subject: [ruby-core:92664] [Ruby trunk Bug#15839] mixed encoding heredoc should be a syntax error regardless the order Issue #15839 has been updated by jeremyevans0 (Jeremy Evans). File mixed-encoding-heredoc-reverse-order-fix.patch added nobu (Nobuyoshi Nakada) wrote: > Thank you, but it doesn't work for the reverse order, `\u` followed by `\x`. That is because the `\x` escape does not do the same type of encoding voodoo that the `\u` escape does. Not sure if we want to change that, or if we do, how exactly it would work. Attached is a patch with a less invasive approach that will still raise the syntax error. It should be applied on top of the previous patch. It checks that the string generated by the heredoc has a valid encoding, after the heredoc has been fully parsed. ---------------------------------------- Bug #15839: mixed encoding heredoc should be a syntax error regardless the order https://bugs.ruby-lang.org/issues/15839#change-78028 * 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) -- https://bugs.ruby-lang.org/ Unsubscribe: