Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I just had a closer look at the module...  Part of the problem is that PDF::EasyPDF specifies the encoding for its 14 Adobe Base Fonts (all it supports) as "MacRomanEncoding" — which is kind of unfortunate, as this encoding is rather different from ISO-8859-1, which Perl defaults to in most cases (for example, "é" is 0x8E in Mac Roman, while it's 0xE9 in ISO-Latin-1 and CP1252).  In other words, even if you had successfully solved the UTF-8 to ISO-8859-1 conversion issue, it still wouldn't work...

But you can get it working with two small changes to EasyPDF.pm  (tested, i.e. works for me):

  1. Replace all 14 occurrences of "/MacRomanEncoding" with "/WinAnsiEncoding" (case is important). Windows ANSI encoding (CP1252) is roughly the equivalent of ISO-8859-1/ISO-8859-15  (one of the differences is that the Euro symbol is in a different position (0xA4 in ISO-8859-15, 0x80 in CP1252).

  2. Change this line

    open (EASYPDF,">$self->{file}") or die ...

    to read

    open (EASYPDF, ">:encoding(cp1252)", $self->{file}) or die ...

    (and don't forget to put use utf8; in your script)

Update: alternatively, you could leave PDF::EasyPDF's /MacRomanEncoding declarations in place, and have Perl convert to that encoding directly (">:encoding(MacRoman)"), which would work, too (except for the Euro symbol)


In reply to Re^3: ( PDF::EasyPDF ) encoding problem by almut
in thread ( PDF::EasyPDF ) encoding problem by lepetitalbert

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-29 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found