richrock Posted March 5, 2013 Share Posted March 5, 2013 Hi, Tearing my hair out with this one, it seems that the inevitable choices of solutions are both intensive pieces of work. I've created a delivery/invoice note generated by FPDF from a shopping cart object in PHP. It's fine, it's been working well, some teething issues and then this: We had some orders from abroad, namely Saudi Arabia and Israel. The system uses country codes which are sent to the payment gateway, and the system also determines regions within a country as linked drop-down list with country. So, in one example, someone has selected Israel, and some indecipherable region/state within Israel. This renders in the PDF as: מחוז המרכז Which is no good to anyone! So I tried to convert DejaVuSans (as recommended in a St***k O******w thread) using the makefont tool, using CP1252 encoding, which is the default. No luck. Tried with ISO-8859-1 - still no luck. Also reran versions with utf8_encode (and utf8_decode just to see what it would do - I was getting desperate at this point). Nothing. The best I got was: ???? ????? Which showed me that FPDF is generating the region - country parts of the address. I now have two options: 1. Convert every non-english address using english characters. A massive job as the cart system doesn't do this, but has the capability (?!?) 2. Create a pdf system for each encoding type - something I would like to avoid too, as some of them may never place orders. The ideal solution, and my question is - is there a font or way I can render foreign character sets without determining the encoding of the PDF? Hope that all makes sense. tl:dr - Can't make fonts work in FPDF for foreign places. Want one solution that doesn't involve masses of work editing databases or files. Quote Link to comment https://forums.phpfreaks.com/topic/275278-fpdf-rendering-of-worldwide-places/ Share on other sites More sharing options...
Jessica Posted March 5, 2013 Share Posted March 5, 2013 It sounds like your font simply doesn't have those characters. You'll want to pick a simple font, probably a system one. Quote Link to comment https://forums.phpfreaks.com/topic/275278-fpdf-rendering-of-worldwide-places/#findComment-1416765 Share on other sites More sharing options...
DavidAM Posted March 5, 2013 Share Posted March 5, 2013 You will also want to make sure that your website and database are all UTF-8 (at least) enabled. If the form is not UTF-8, then you may be sending the wrongly encoded data to the server. If the database is not UTF-8 you may be storing it wrongly. If the Database connection is not using UTF-8 (immediately after connecting) it may not be retrieving it correctly. I have not worked with FPDF, but you need to look at its settings for UTF-8 as well. The CP1252 encoding, and ISO-8859-1 are not likely to support those characters at all. Quote Link to comment https://forums.phpfreaks.com/topic/275278-fpdf-rendering-of-worldwide-places/#findComment-1416811 Share on other sites More sharing options...
dernittectiog Posted March 6, 2013 Share Posted March 6, 2013 ルブタン ナイキ スリッポン ヴィヴィアン 長財布 Quote Link to comment https://forums.phpfreaks.com/topic/275278-fpdf-rendering-of-worldwide-places/#findComment-1416873 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.