Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make Buf.decode work
Signed-off-by: Moritz Lenz <moritz@faui2k3.org>
  • Loading branch information
nwellnhof authored and moritz committed Dec 23, 2010
1 parent b5c0165 commit a5a9364
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/Buf.pm
Expand Up @@ -5,7 +5,11 @@ role Buf[::T = Int] does Stringy does Positional {
self.bless(*, :contents(@contents.list));
}

multi method decode($encoding = 'UTF-8') {
multi method decode($encoding is copy = 'UTF-8') {
$encoding .= lc;
if $encoding eq 'utf-8' {
$encoding = 'utf8';
}
my @contents = @.contents;
my $str = ~Q:PIR {
$P0 = find_lex '@contents'
Expand All @@ -25,7 +29,9 @@ role Buf[::T = Int] does Stringy does Positional {
inc i
goto loop
done:
s = bb.'get_string_as'(utf8:" ")
$P1 = find_lex '$encoding'
$S1 = $P1
s = bb.'get_string'($S1)
%r = box s
};
return $str;
Expand Down

0 comments on commit a5a9364

Please sign in to comment.