String Byte Length: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: UTF-16: extra 2 bytes is probably Unicode BOM)
Line 271: Line 271:
assert len(s) == 5
assert len(s) == 5
assert len(s.encode('UTF-8')) == 7
assert len(s.encode('UTF-8')) == 7
assert len(s.encode('UTF-16')) == 12 #XXX it should be `10' as problem statement says
assert len(s.encode('UTF-16')) == 12 # The extra character is probably a leading Unicode byte-order mark (BOM).


=={{header|Ruby}}==
=={{header|Ruby}}==