st0012 · GitHub

When a C file references another source file via `/* in file.c */`,
the parser read it with bare `File.read` which uses
`Encoding.default_external`. On systems where this is US-ASCII
(e.g. Debian CI), non-ASCII bytes in the source file cause
`ArgumentError: invalid byte sequence in US-ASCII` in String#scan.
Use `RDoc::Encoding.read_file` instead, which reads in binary mode
and properly handles encoding detection and transcoding.
This was triggered by Ruby commit a2531ba293 which added UTF-8
right arrows (→) in comments in class.c, which is referenced from
object.c via `/* in class.c */`.

@st0012

st0012 marked this pull request as ready for review

March 22, 2026 14:38

kou

kou approved these changes Mar 22, 2026

@st0012

@st0012

st0012 deleted the fix-c-parser-encoding-external-source branch

March 22, 2026 23:59

st0012 added a commit to st0012/ruby that referenced this pull request

Mar 23, 2026
The latest RDoc contains ruby/rdoc#1657, which
fixes install-doc failures on some platforms.

Merged

st0012 added a commit to st0012/ruby that referenced this pull request

Mar 23, 2026
The latest RDoc contains ruby/rdoc#1657, which
fixes install-doc failures on some platforms.

st0012 added a commit to st0012/ruby that referenced this pull request

Mar 23, 2026
The latest RDoc contains ruby/rdoc#1657, which
fixes install-doc failures on some platforms.

st0012 added a commit to st0012/ruby that referenced this pull request

Mar 23, 2026
The latest RDoc contains ruby/rdoc#1657, which
fixes install-doc failures on some platforms.

st0012 added a commit to st0012/ruby that referenced this pull request

Mar 23, 2026
The latest RDoc contains ruby/rdoc#1657, which
fixes install-doc failures on some platforms.

st0012 added a commit to ruby/ruby that referenced this pull request

Mar 23, 2026
The latest RDoc contains ruby/rdoc#1657, which
fixes install-doc failures on some platforms.

k0kubun pushed a commit that referenced this pull request

May 12, 2026
When a C file references another source file via `/* in file.c */`, the
parser read it with bare `File.read` which uses
`Encoding.default_external`. On systems where this is US-ASCII (e.g.
Debian CI), non-ASCII bytes in the source file cause `ArgumentError:
invalid byte sequence in US-ASCII` in String#scan.
Use `RDoc::Encoding.read_file` instead, which reads in binary mode and
properly handles encoding detection and transcoding.
This was triggered by Ruby commit
[`a2531ba293`](ruby/ruby@ a2531ba293 ) which
added UTF-8 right arrows (→) in comments in `class.c`, which is
referenced from `object.c` via `/* in class.c */`.

k0kubun pushed a commit that referenced this pull request

May 12, 2026
When a C file references another source file via `/* in file.c */`, the
parser read it with bare `File.read` which uses
`Encoding.default_external`. On systems where this is US-ASCII (e.g.
Debian CI), non-ASCII bytes in the source file cause `ArgumentError:
invalid byte sequence in US-ASCII` in String#scan.
Use `RDoc::Encoding.read_file` instead, which reads in binary mode and
properly handles encoding detection and transcoding.
This was triggered by Ruby commit
[`a2531ba293`](ruby/ruby@ a2531ba293 ) which
added UTF-8 right arrows (→) in comments in `class.c`, which is
referenced from `object.c` via `/* in class.c */`.

k0kubun pushed a commit that referenced this pull request

May 12, 2026
When a C file references another source file via `/* in file.c */`, the
parser read it with bare `File.read` which uses
`Encoding.default_external`. On systems where this is US-ASCII (e.g.
Debian CI), non-ASCII bytes in the source file cause `ArgumentError:
invalid byte sequence in US-ASCII` in String#scan.
Use `RDoc::Encoding.read_file` instead, which reads in binary mode and
properly handles encoding detection and transcoding.
This was triggered by Ruby commit
[`a2531ba293`](ruby/ruby@ a2531ba293 ) which
added UTF-8 right arrows (→) in comments in `class.c`, which is
referenced from `object.c` via `/* in class.c */`.

Read the original on github.com ↗