Skip to content

Commit 8415f8f

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
[DOC] Use Japanese for multi-byte characters
1 parent a92c034 commit 8415f8f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

doc/language/packed_data.rdoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -457,15 +457,15 @@ for one byte in the input or output string.
457457
"foo ".unpack('A4') # => ["foo"]
458458
"foo".unpack('A4') # => ["foo"]
459459

460-
russian = "\u{442 435 441 442}" # => "тест"
461-
russian.size # => 4
462-
russian.bytesize # => 8
463-
[russian].pack('A') # => "\xD1"
464-
[russian].pack('A*') # => "\xD1\x82\xD0\xB5\xD1\x81\xD1\x82"
465-
russian.unpack('A') # => ["\xD1"]
466-
russian.unpack('A2') # => ["\xD1\x82"]
467-
russian.unpack('A4') # => ["\xD1\x82\xD0\xB5"]
468-
russian.unpack('A*') # => ["\xD1\x82\xD0\xB5\xD1\x81\xD1\x82"]
460+
japanese = 'こんにちは'
461+
japanese.size # => 5
462+
japanese.bytesize # => 15
463+
[japanese].pack('A') # => "\xE3"
464+
[japanese].pack('A*') # => "\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB\xE3\x81\xA1\xE3\x81\xAF"
465+
japanese.unpack('A') # => ["\xE3"]
466+
japanese.unpack('A2') # => ["\xE3\x81"]
467+
japanese.unpack('A4') # => ["\xE3\x81\x93\xE3"]
468+
japanese.unpack('A*') # => ["\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB\xE3\x81\xA1\xE3\x81\xAF"]
469469

470470
- <tt>'a'</tt> - Arbitrary binary string (null padded; count is width):
471471

0 commit comments

Comments
 (0)