Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^4: PDF::API2 Questions

by akwe-xavante (Acolyte)
on Mar 16, 2012 at 09:58 UTC ( [id://959949]=note: print w/replies, xml ) Need Help??


in reply to Re^3: PDF::API2 Questions
in thread PDF::API2 Questions

I'm my question is a really silly but i have my problem that i've failed to resolve even after googling it a number of times

How on earth do you get a correct £ character into a PDF document without letter A in front of it?

How do get all the special characters even?

Replies are listed 'Best First'.
Re^5: PDF::API2 Questions
by Eliya (Vicar) on Mar 16, 2012 at 10:58 UTC
    How do get all the special characters even?

    Primarily, you need a font that supports the desired character(s) (= does have a glyph for it).  And with characters outside of the Latin-1 range ('£' is not one of them), you want to use Unicode, which (according to my tests) means you can't use the core fonts any longer, but need to switch to using TrueType fonts, for example (see also Re^2: PDF::API2 / unicode characters).

    Depending on where the special characters are coming from - i.e. from literal strings within the source, from files outside of the program, etc. - you need to use utf8 (when your source is UTF-8 encoded), and maybe use feature 'unicode_strings' (avoids a number of more subtle legacy issues and ambiguities with Perl's handling of Unicode (works with newer perls only)), and/or set the PerlIO encoding layer correctly for the respective file handles that the special character are read from.

    As for the letter A in front of £ (I suppose you really meant Â), the problem most likely is that your source code is in UTF-8, but you did not tell Perl about it (see paragraph above) — the UTF-8 encoding of the pound sign is the two bytes \xc2 \xa3, which when incorrectly interpreted as two Latin-1 characters, renders as '£'.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-23 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found