On 6/19/22 02:30, William Michels via perl6-users wrote:
On Sun, Jun 19, 2022 at 2:16 AM ToddAndMargo via perl6-users
<perl6-us...@perl.org> wrote:
On 6/19/22 02:14, ToddAndMargo via perl6-users wrote:
On Sun, Jun 19, 2022 at 12:55 AM ToddAndMargo via perl6-users
<perl6-us...@perl.org> wrote:
Hi All,
https://docs.raku.org/routine/encode
multi method encode(Str:D $encoding = 'utf8', :$replacement, Bool()
:$translate-nl = False, :$strict)
shows "ascii" and "utf8" as possible values for
"$encoding".
I tool a guess and found out "utf16".
Where are the rest of the values???? GGGGRRRRR!!!!
-T
On 6/19/22 01:55, William Michels via perl6-users wrote:
> Hi Todd,
>
> It's great that you've delved into the "encode" docs.
> However to answer your question, I think you want to look at the
> "encoding" routine page:
>
> https://docs.raku.org/routine/encoding#class_IO::Handle
>
> Here's the list on that page:
>
> utf8
> utf16
> utf16le
> utf16be
> utf8-c8
> iso-8859-1
> windows-1251
> windows-1252
> windows-932
> ascii
>
> HTH, Bill.
>
>
Yes that helps greatly. Thank you!
It would probably kill them to put a link to that
on the first page.
That's a great idea, and probably should be done. In the meanwhile
maybe you can test out some of the different encoding names--and let
us on the mailing-list know that everything is working okay?
Thx --B.
They all seem to work
I did not come up with a specific example for each though.
[0] > my Str $str = "Þor is mighty";
Þor is mighty
[1] > say $str.encode("ascii", :replacement( 'Th') ).decode("ascii");
Thor is mighty
[1] > say $str.encode("utf8", :replacement( 'Th') ).decode("utf8");
Þor is mighty
[1] > say $str.encode("utf16", :replacement( 'Th') ).decode("utf16");
Þor is mighty
[1] > say $str.encode("utf16le", :replacement( 'Th') ).decode("utf16le");
Þor is mighty
[1] > say $str.encode("utf8-c8", :replacement( 'Th') ).decode("utf8-c8");
Þor is mighty
[1] > say $str.encode("iso-8859-1", :replacement( 'Th')
).decode("iso-8859-1");
Þor is mighty
[1] > say $str.encode("windows-1251", :replacement( 'Th')
).decode("windows-1251");
Юor is mighty
[1] > say $str.encode("windows-1252", :replacement( 'Th')
).decode("windows-1252");
Þor is mighty
[1] > say $str.encode("windows-932", :replacement( 'Th')
).decode("windows-932");
Thor is mighty
[1] > say $str.encode("ascii", :replacement( 'Th') ).decode("ascii");
Thor is mighty
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~