Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Psych::Parser#strip_bom

strip_bom(yaml)

libyaml only skips a leading byte order mark when it detects the stream encoding by itself. Psych passes the encoding explicitly whenever it is known, and on that path libyaml counts the BOM as a first-line character, which shifts the column of every token on the first line and silently terminates a block mapping at the second line [Bug #13615].

See also #skip_io_bom #parse