Skip to content

implement "use source::encoding" #19389

@rjbs

Description

@rjbs

RFC 7 is the "source encoding pragma", meant to allow the programmer to declare the encoding of the source document. Right now, we have two options for this:

  • use utf8 which says "this source document is UTF-8 encoded, decode it before compiling"
  • not using use utf8 which says "this source document is bytes"

Both of these options lead to confusion of one sort or another, and I am not here (today, anyway) to argue which is absolutely better. But what is lacking is:

  • use ascii to say "if it's not ASCII, which is unambiguous in meaning, reject compilation"

The new pragma is meant to be a one-stop-shop for declaring any of the above, to be called as:

  • use source::encoding 'ascii'
  • use source::encoding 'utf8'
  • no source::encoding (but this one is probably better avoided)

I proposed that the utf8 form do the same thing as utf8, and that over time we tighten up the strictness of utf8.pm, and then also of the exact codepoint sequences permitted in Perl source -- but those enhancements can happen later than and separately from this pragma.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions