ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: merch-redmine@jeremyevans.net
To: ruby-core@ruby-lang.org
Subject: [ruby-core:92673] [Ruby trunk Bug#15839] mixed encoding heredoc should be a syntax error regardless the order
Date: Wed, 15 May 2019 23:24:41 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-78036.20190515232440.881392b4858a7868@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15839.20190509064559@ruby-lang.org

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/

  parent reply	other threads:[~2019-05-15 23:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15839.20190509064559@ruby-lang.org>
2019-05-09  6:45 ` [ruby-core:92608] [Ruby trunk Bug#15839] mixed encoding heredoc should be a syntax error regardless the order nobu
2019-05-15  5:13 ` [ruby-core:92650] " merch-redmine
2019-05-15  9:31 ` [ruby-core:92656] " nobu
2019-05-15 15:24 ` [ruby-core:92664] " merch-redmine
2019-05-15 23:24 ` merch-redmine [this message]
2019-05-20  3:00 ` [ruby-core:92727] " nobu
2019-05-20  3:59 ` [ruby-core:92728] " merch-redmine
2019-08-01 13:56 ` [ruby-core:94096] [Ruby master " nagachika00
2019-08-26 15:36 ` [ruby-core:94572] " usa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-78036.20190515232440.881392b4858a7868@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).