Jump to content



Latest News: (loading..)

euro sign in invoice pdf


This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#-19   ikbel

ikbel
  • Members
  • 20 posts

Posted 07 June 2011 - 09:54 AM

i use pdf_customer_invoice_v1.3, I use the euro sign and it is displayed without any errors. But as soon as a try to print a quote as a pdf, the euro-sign is replaced by € . (a strange couple of characters).

#-18   ikbel

ikbel
  • Members
  • 20 posts

Posted 07 June 2011 - 11:55 AM

finally i find the solution: replace $s=str_replace("\r",'',$txt); by $s=eregi_replace("€", chr(128), $txt); in fpdf.php

Edited by ikbel, 07 June 2011 - 11:57 AM.


#-17   MrPhil

MrPhil
  • Members
  • 4,194 posts

Posted 08 June 2011 - 12:17 AM

A few problems there...
1) str_replace("\r",'',$txt) is getting rid of carriage return characters. What have you broken by eliminating that?
2) eregi_replace is a deprecated function and as soon as you go to PHP 5.3 you're going to get warnings. You should be using preg_replace.
3) chr(128) (x80) is applicable only to Windows-1252 character encoding (so-called "Smart Quotes" from Micro$oft). Beware of using it anywhere else, and make sure you know what character encodings are being used to create the PDF. As long as everything is consistent (the hard-coded Euro in the string, the replacement code, and what the PDF software is expecting), you're probably safe, but you'll be left twisting in the breeze if encodings change.

#-16   Huroman

Huroman
  • Members
  • 19 posts

Posted 28 November 2011 - 06:00 PM

@MrPhil, but what solution you could give to us, please? I'm not a php ninja coder per se and could it be awesome some help around here.

#-15   MrPhil

MrPhil
  • Members
  • 4,194 posts

Posted 29 November 2011 - 04:30 AM

For displaying a Euro sign, I would suggest defining the currency to be & euro; (close up the gap) rather than using a hard coded "binary" character code (128 or any other value/multibyte sequence). That will definitely work for osC page display; maybe it will work too for a PDF invoice, if its original source was HTML.