Re: Malformed UTF-8 ???

2018-10-20 Thread ToddAndMargo via perl6-users
On 10/19/18 7:58 PM, ToddAndMargo via perl6-users wrote: if    $StdErr  { $proc  = run( @RunArray, :err, :out, :enc ); }    elsif $StdOut  { $proc  = run( @RunArray,   :out, :enc ); }  # STDERR goes to the terminal    else   { $proc  = run( @RunArray, :err, :out, :enc 

Re: Malformed UTF-8 ???

2018-10-19 Thread ToddAndMargo via perl6-users
On 10/19/18 7:58 PM, ToddAndMargo via perl6-users wrote: sub RunNoShellAll( Str $RunString, Bool $StdOut, Bool $StdErr, Bool $Code, --> List ) { Had to remove the --> List to get rid of the random core dumps https://github.com/rakudo/rakudo/issues/2403

Re: Malformed UTF-8 ???

2018-10-19 Thread ToddAndMargo via perl6-users
On 10/16/18 3:59 AM, ToddAndMargo via perl6-users wrote: This is going through a rewrite.  So, don't help me until I clean this up.  I hope to have some time Friday, but maybe not.  I will get back. -T Rewrite worked! sub RunNoShellAll( Str $RunString, Bool $StdOut, Bool $StdErr, Bool

Re: Malformed UTF-8 ???

2018-10-16 Thread ToddAndMargo via perl6-users
On 10/15/18 6:46 PM, Curt Tilmes wrote: On Mon, Oct 15, 2018 at 9:44 PM Brandon Allbery > wrote: Isn't the point that it's $ReturnStr that's throwing the immutable error, not $RunString? That's what I see in the thread history You're right.  My thinko. 

Re: Malformed UTF-8 ???

2018-10-15 Thread Curt Tilmes
On Mon, Oct 15, 2018 at 9:44 PM Brandon Allbery wrote: > Isn't the point that it's $ReturnStr that's throwing the immutable error, > not $RunString? That's what I see in the thread history > You're right. My thinko. Sorry. > On Mon, Oct 15, 2018 at 9:40 PM Curt Tilmes wrote: > >> >> >> On

Re: Malformed UTF-8 ???

2018-10-15 Thread Brandon Allbery
Isn't the point that it's $ReturnStr that's throwing the immutable error, not $RunString? That's what I see in the thread history. On Mon, Oct 15, 2018 at 9:40 PM Curt Tilmes wrote: > > > On Mon, Oct 15, 2018 at 9:34 PM ToddAndMargo via perl6-users < > perl6-us...@perl.org> wrote: > >> On

Re: Malformed UTF-8 ???

2018-10-15 Thread Curt Tilmes
On Mon, Oct 15, 2018 at 9:34 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 10/15/18 9:04 AM, Larry Wall wrote: > > This almost certainly means that $ReturnStr is a read-only paramater to > > a routine. Add "is copy" to the declaration if you want to modify it. > > I am not

Re: Malformed UTF-8 ???

2018-10-15 Thread ToddAndMargo via perl6-users
On 10/15/18 9:04 AM, Larry Wall wrote: On Sun, Oct 14, 2018 at 02:03:23AM -0700, ToddAndMargo via perl6-users wrote: : On 10/13/18 3:02 AM, ToddAndMargo via perl6-users wrote: : >Hi All, : > : > if  $StdOut  { $ReturnStr = $$proc.out.slurp-rest; } : > : >gives me : > : > Malformed

Re: Malformed UTF-8 ???

2018-10-15 Thread ToddAndMargo via perl6-users
> On Sun, Oct 14, 2018 at 11:30 AM ToddAndMargo via perl6-users > mailto:perl6-us...@perl.org>> wrote: > > On 10/14/18 3:08 AM, Ralph Mellor wrote: > > This code works fine: > > > > spurt 'foo', 'bar'; > > my Str $ReturnStr = ""; > > $ReturnStr =

Re: Malformed UTF-8 ???

2018-10-15 Thread Larry Wall
On Sun, Oct 14, 2018 at 02:03:23AM -0700, ToddAndMargo via perl6-users wrote: : On 10/13/18 3:02 AM, ToddAndMargo via perl6-users wrote: : >Hi All, : > : > if  $StdOut  { $ReturnStr = $$proc.out.slurp-rest; } : > : >gives me : > : > Malformed UTF-8 : > : >How do I clean up

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
It's redundant for this code. `$foo` means data that's to be treated as either a single item or as a single item container containing a single item. `$$foo` means put the single item in $foo into a single item container containing it. Given that this appears on the right of `=` the single item

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
I see no significant difference beyond the inside of your proc and the outside of the code you've shown. The extra `$` in `$$proc` is redundant. (I don't understand why you have it.) The `(...)` is the same as my `: ...`. It can wait until you switch to `slurp`. I wouldn't expect it to make

Re: Malformed UTF-8 ???

2018-10-14 Thread Tom Browder
On Sun, Oct 14, 2018 at 5:13 AM Ralph Mellor wrote: > > Almost certainly your problem is elsewhere. What is the meaning of the double dollar sign ($$) in the problem code? -Tom

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/14/18 3:08 AM, Ralph Mellor wrote: This code works fine: spurt 'foo', 'bar'; my Str $ReturnStr = ""; $ReturnStr = 'foo'.IO.open.slurp-rest: enc => 'utf8-c8'; say $ReturnStr; # bar Try it with my layout: $ReturnStr = $$proc.out.slurp-rest( enc => 'utf8-c8' );

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
> > > On Sun, Oct 14, 2018 at 11:08 AM Ralph Mellor > wrote: > > Are you sure the error message you showed applies to the line you > showed? > > This code works fine: > > spurt 'foo', 'bar'; > my Str $ReturnStr = ""; > $ReturnStr =

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
Almost certainly your problem is elsewhere. When you refer to a variable as a *value* then you get its *value*. So: return $ReturnStr returns $ReturnStr's *value*, not the variable. Your code returns such a value, which will be an immutable string. So I think the error message you're getting

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
Are you sure the error message you showed applies to the line you showed? This code works fine: spurt 'foo', 'bar'; my Str $ReturnStr = ""; $ReturnStr = 'foo'.IO.open.slurp-rest: enc => 'utf8-c8'; say $ReturnStr; # bar -- raiph On Sun, Oct 14, 2018 at 10:52 AM ToddAndMargo via perl6-users <

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On Sun, Oct 14, 2018 at 10:35 AM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: On 10/14/18 2:29 AM, Ralph Mellor wrote: > In P6 "assign" means use of `=`. > > And "assign to" means to copy into the thing on the left of the `=`. > > And to copy

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
I just tried slurp-rest with a specified encoding and it worked fine. Are you sure you don't bind $ReturnStr between the declaration you've shiown and the use you've shown? -- raiph On Sun, Oct 14, 2018 at 10:35 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 10/14/18 2:29

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/14/18 2:29 AM, Ralph Mellor wrote: In P6 "assign" means use of `=`. And "assign to" means to copy into the thing on the left of the `=`. And to copy into something the thing has to be a mutable container. The error message is saying that $ReturnStr is bound to an immutable value (eg a

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
Couple clarifications about my prior message. > And to copy into something the thing has to be a mutable container. "mutable" and "container" are basically redundant with each other. Mutable means changeable. Container means data that has only one purpose, namely to be changeable. > that's

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/14/18 2:21 AM, Ralph Mellor wrote: OK. That makes sense. So the program that you're running for the $proc is producing malformed UTF8. Why don't you fix that rather than clean up afterwards? -- raiph Hi Raiph, I am reading the contents from a web page through my "curl" interface

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
In P6 "assign" means use of `=`. And "assign to" means to copy into the thing on the left of the `=`. And to copy into something the thing has to be a mutable container. The error message is saying that $ReturnStr is bound to an immutable value (eg a string) not a container. So that's

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
OK. That makes sense. So the program that you're running for the $proc is producing malformed UTF8. Why don't you fix that rather than clean up afterwards? -- raiph On Sun, Oct 14, 2018 at 3:44 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > >> > >> > >> On Sat, Oct 13, 2018

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/13/18 3:02 AM, ToddAndMargo via perl6-users wrote: Hi All, if  $StdOut  { $ReturnStr = $$proc.out.slurp-rest; } gives me Malformed UTF-8 How do I clean up $$proc.out.slurp-rest ?? Many thanks, -T This does not work: if $StdOut { $ReturnStr = $$proc.out.slurp-rest( enc

Re: Malformed UTF-8 ???

2018-10-13 Thread ToddAndMargo via perl6-users
>> >> Hi All, >> >>if $StdOut { $ReturnStr = $$proc.out.slurp-rest; } >> >> gives me >> >>Malformed UTF-8 >> >> How do I clean up $$proc.out.slurp-rest ?? >> >> Many thanks, >> -T On 10/13/18 8:18 AM, Brad Gilbert wrote: Change the encoding to `utf8-c8` to let the invalid

Re: Malformed UTF-8 ???

2018-10-13 Thread ToddAndMargo via perl6-users
On Sat, Oct 13, 2018 at 11:18 AM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: Hi All, if $StdOut { $ReturnStr = $$proc.out.slurp-rest; } gives me Malformed UTF-8 How do I clean up $$proc.out.slurp-rest ?? Many thanks, -T

Re: Malformed UTF-8 ???

2018-10-13 Thread Brad Gilbert
Change the encoding to `utf8-c8` to let the invalid unicode through. or use binary methods. or make sure it isn't in some other encoding. On Sat, Oct 13, 2018 at 5:18 AM ToddAndMargo via perl6-users wrote: > > Hi All, > > if $StdOut { $ReturnStr = $$proc.out.slurp-rest; } > > gives me >

Re: Malformed UTF-8 ???

2018-10-13 Thread Ralph Mellor
Why are you asking about cleaning something up? Is it because you thought `Malformed UTF-8` was an error message? If so, great, because it IS an error message. If not, you need to know that Malformed UTF-8 is an error message and we need to think about how to make that more clear. So that's

Re: Malformed UTF-8?

2018-06-16 Thread ToddAndMargo
On Sat, Jun 16, 2018 at 1:09 AM ToddAndMargo > wrote: rakudo-pkg-Fedora28-2018.05-01.x86_64.rpm $ perl6 -v This is Rakudo version 2018.05 built on MoarVM version 2018.05 implementing Perl 6.c. What did I do wrong, this time? Malformed

Re: Malformed UTF-8?

2018-06-16 Thread ToddAndMargo
On 06/16/2018 08:37 AM, The Sidhekin wrote: On Sat, Jun 16, 2018 at 5:19 PM, Brandon Allbery > wrote: Something's wrong with the data file you are reading. Perl 6 is expecting UTF-8 encoding and getting something else (usually an ISO-8859 encoding).  

Re: Malformed UTF-8?

2018-06-16 Thread The Sidhekin
On Sat, Jun 16, 2018 at 5:19 PM, Brandon Allbery wrote: > Something's wrong with the data file you are reading. Perl 6 is expecting > UTF-8 encoding and getting something else (usually an ISO-8859 encoding). > Are you sure it's a data file? I thought I recognized that code, and it was

Re: Malformed UTF-8?

2018-06-16 Thread Brandon Allbery
Something's wrong with the data file you are reading. Perl 6 is expecting UTF-8 encoding and getting something else (usually an ISO-8859 encoding). On Sat, Jun 16, 2018 at 1:09 AM ToddAndMargo wrote: > rakudo-pkg-Fedora28-2018.05-01.x86_64.rpm > $ perl6 -v > This is Rakudo version 2018.05 built