Skip to content

Commit

Permalink
Describes new options of encode, refs #1233
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Aug 9, 2018
1 parent 90ca7af commit 655a103
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc/Type/Encoding/Registry.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ available for any Perl 6 application, namely:
=item C<utf8>
=item C<utf8-c8>
=item Cutf16>
=item C<utf16>
=item C<utf32>, C<utf-32>
=item C<ascii>
=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>
Expand Down
17 changes: 11 additions & 6 deletions doc/Type/Str.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,17 @@ currently erroneously returns the number of codepoints instead.
=head2 method encode
multi method encode(Str:D: $encoding, $nf --> Blob)
Returns a L<Blob> which represents the original string in the given encoding
and normal form. The actual return type is as specific as possible, so
C<$str.encode('UTF-8')> returns a C<utf8> object,
C<$str.encode('ISO-8859-1')> a C<buf8>.
multi method encode(Str:D $encoding = 'utf8', :$replacement,
Bool() :$translate-nl = False, :$strict)
Returns a L<Blob> which represents the original string in the given encoding and
normal form. The actual return type is as specific as possible, so
C<$str.encode('UTF-8')> returns a C<utf8> object, C<$str.encode('ISO-8859-1')> a
C<buf8>. If C<:translate-nl> is set to C<True>, it will translate newlines from
C<\n> to C<\n\r>, but only in Windows. C<$replacement> indicates how characters
are going to be replaced in the case they are not available in the current
encoding, while C<$strict> indicates whether unmapped codepoints will still
decode; for instance, codepoint 129 which does not exist in C<windows-1252>.
=head2 routine index
Expand Down

0 comments on commit 655a103

Please sign in to comment.