From b664590c4d7bb6cd4f48c61c3d8a480cd887672c Mon Sep 17 00:00:00 2001 From: Adam Daniels Date: Tue, 2 Apr 2024 10:07:52 -0400 Subject: [PATCH] [DOC] Fix examples for `u` packing directive The directive is a lowercase `u` instead of an uppercase `U`. Adjusted input and output to match. Reported by Leah Neukirchen. --- doc/packed_data.rdoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/packed_data.rdoc b/doc/packed_data.rdoc index ec0e2c07f0..17bbf92023 100644 --- a/doc/packed_data.rdoc +++ b/doc/packed_data.rdoc @@ -554,10 +554,12 @@ for one byte in the input or output string. - 'u' - UU-encoded string: - [0].pack("U") # => "\u0000" - [0x3fffffff].pack("U") # => "\xFC\xBF\xBF\xBF\xBF\xBF" - [0x40000000].pack("U") # => "\xFD\x80\x80\x80\x80\x80" - [0x7fffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF" + [""].pack("u") # => "" + ["a"].pack("u") # => "!80``\n" + ["aaa"].pack("u") # => "#86%A\n" + + "".unpack("u") # => [""] + "#86)C\n".unpack("u") # => ["abc"] == Offset Directives