Skip to content

Commit 655a103

Browse files
committed
Describes new options of encode, refs #1233
1 parent 90ca7af commit 655a103

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

doc/Type/Encoding/Registry.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ available for any Perl 6 application, namely:
1111
1212
=item C<utf8>
1313
=item C<utf8-c8>
14-
=item Cutf16>
14+
=item C<utf16>
1515
=item C<utf32>, C<utf-32>
1616
=item C<ascii>
1717
=item C<iso-8859-1>, C<iso_8859-1:1987>, C<iso_8859-1>, C<iso-ir-100>, C<latin1>, C<latin-1>, C<csisolatin1>, C<l1>, C<ibm819>, C<cp819>

doc/Type/Str.pod6

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,17 @@ currently erroneously returns the number of codepoints instead.
123123
124124
=head2 method encode
125125
126-
multi method encode(Str:D: $encoding, $nf --> Blob)
127-
128-
Returns a L<Blob> which represents the original string in the given encoding
129-
and normal form. The actual return type is as specific as possible, so
130-
C<$str.encode('UTF-8')> returns a C<utf8> object,
131-
C<$str.encode('ISO-8859-1')> a C<buf8>.
126+
multi method encode(Str:D $encoding = 'utf8', :$replacement,
127+
Bool() :$translate-nl = False, :$strict)
128+
129+
Returns a L<Blob> which represents the original string in the given encoding and
130+
normal form. The actual return type is as specific as possible, so
131+
C<$str.encode('UTF-8')> returns a C<utf8> object, C<$str.encode('ISO-8859-1')> a
132+
C<buf8>. If C<:translate-nl> is set to C<True>, it will translate newlines from
133+
C<\n> to C<\n\r>, but only in Windows. C<$replacement> indicates how characters
134+
are going to be replaced in the case they are not available in the current
135+
encoding, while C<$strict> indicates whether unmapped codepoints will still
136+
decode; for instance, codepoint 129 which does not exist in C<windows-1252>.
132137
133138
=head2 routine index
134139

0 commit comments

Comments
 (0)