On Tue, Dec 23, 2008 at 3:44 PM, Sean Healy <jalope...@hotmail.com> wrote:
> Octavian Rasnita wrote:
>
>> I've just installed the editor Padre using cpan, and I have tried to run
>> the following script:
>>
>> use utf8;
>>
>> binmode STDOUT, ":utf8";
>>
>> print "ţâţă de mâţă";
>>
>> #But when running the program with F5 it prints:
>> ĹŁĂ˘ĹŁÄƒ de mĂ˘ĹŁÄƒ
>>
>> ...instead of those UTF-8 chars.
>>
>> Can I do something to make it print the correct chars?
>
> Quick disclaimer: I have nothing to do with this project.

that's a pity. We would be glad to have you in the team.

>
> I took a quick look and found the problem: Padre runs your script as a
> process and gets back the process's STDOUT, but Padre doesn't know or care
> that your script was printing in utf8 - it just treats it as a bunch of
> bytes.
>
> I was able to fix it by adding the following code to Padre/Wx/Output.pm:
>
> use Encode;
> sub AppendText {
>        my ($self, $text) = @_;
>        my $string = decode("utf8", $text);
>        $self->SUPER::AppendText($string);
> }

I applied that to padre now.

>
> This could (and should) be extended to allow any encoding in the output
> window. Perhaps I'll do that next week, and submit a patch to the Padre
> team.

that would be even better

  Gabor

Reply via email to