On Jan 25, 2012, at 12:53 PM, Patrice Dumas via RT wrote:
Show quoted text> I could have a try.
>
> I think that an encoding attribute on the Pod::Simple object would not
> be enough, because it would not be possible to know when it becomes
> avalable if one do not know that an =encoding was just processed.
>
> Typically, when starting the parsing, this wouldn't be set, but when
> the end of an =encoding happens, it would be the right moment to
> look at the encoding attribute.
I guess your formatter could just not output anything until it knows what encoding it’s dealing with. And it would reach that point once the the =encoding was seen. In fact, you can already get that via $self->{encoding}.
Note what `perlpod` says about =encoding:
Show quoted text> "=encoding encodingname"
> This command is used for declaring the encoding of a document.
> Most users won’t need this; but if your encoding isn’t US‐ASCII or
> Latin−1, then put a "=encoding encodingname" command early in the
> document so that pod formatters will know how to decode the
> document. For encodingname, use a name recognized by the
> Encode::Supported module. Examples:
>
> =encoding utf8
>
> =encoding koi8−r
>
> =encoding ShiftJIS
>
> =encoding big5
>
> "=encoding" affects the whole document, and must occur only once.
So once you see $self->{encoding} has a value, you should be good to go.
Best,
David