Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: utf8 problems with Pod-ProjectDocs

by remiah (Hermit)
on Sep 25, 2012 at 01:24 UTC ( #995475=note: print w/ replies, xml ) Need Help??


in reply to utf8 problems with Pod-ProjectDocs

I couldn't fully trace this, nor understand all. If you are going to have some trial, 4 lines of dirty patch to ProjectDocs::Parse.pm seems to me work.

1. decode $self->{buffer} to character. Add 2 lines

use Encode qw/decode/; $self->{buffer}=decode('UTF-8', $self->{buffer});
just after the line
$self->{buffer} = join "\n", qq[<div class="pod">], $self->{buffer}, " +</div>";
,which is in the "end_pos" sub.

2. encode $self->{buffer} back. Add 2 lines
use Encode(qw/encode/); $self->{buffer}=encode('UTF-8', $self->{buffer});
just after
$self->SUPER::parse_from_file(@_);
,which is in "parse_from_file" sub.

before SUPER::parse_from_file, it has no troble. after SUPER::parse_from_file, it is troubled. "end_pos" is callback from Pod::Parser.


Comment on Re: utf8 problems with Pod-ProjectDocs
Select or Download Code
Replies are listed 'Best First'.
Re^2: utf8 problems with Pod-ProjectDocs
by LanX (Canon) on Sep 25, 2012 at 11:02 UTC
    Thanks!

    I recommended your patch to the maintainer of our installation. =)

    Cheers Rolf

Re^2: utf8 problems with Pod-ProjectDocs
by Anonymous Monk on Sep 23, 2013 at 09:10 UTC
    I think you got it the wrong way round: encode(...) in end_pod and decode(...) in parse_from_file works for me.

      Hello

      I checked my test at that time, and I find no problems with Pod::ProjectDocs with no patch.
      I wonder whether this is fix of ProjectDocs, or Pod::Parser or my dream ???
      If you post your test case, I would like to check it. Mine was like this, and again, I see no problem now...

      test.pl

      #!/usr/bin/perl -w use strict; use warnings; use utf8; use lib './Pod-ProjectDocs-0.40/lib'; use Pod::ProjectDocs; my $pd = Pod::ProjectDocs->new( outroot => './out', libroot => './lib', title => '&#12503;&#12525;&#12472;&#12455;&#12463;&#12488;', lan =>'UTF-8', ); print "before gen\n"; $pd->gen();
      And target script in "lib"
      #!/usr/bin/perl =pod =head1 For POD TEST () =cut
      regards

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995475]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (18)
As of 2015-07-29 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls