Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi. I need to write some croatian sentences in PDF file using FPDF and PHP.
I know that the code for this language is CP1250 or Windows-1250 but it doesn't write these types of letters correctly - "Č,Ć,Š,Ž...".
PHP



What I have tried:

So far I have this code which apparently is not working:
PHP
$data = iconv('UTF-8', 'CP1250//TRANSLIT', $data);
Posted
Updated 4-May-16 9:20am

1 solution

This is because CP-1250, as well all other "Code Page" encodings are never used anymore, is totally dead. At the same time, for compatibility reasons, such encodings are supported in some software, including the OS, especially Windows, but mostly indirectly. Nevertheless, nothing works with these encodings natively. And of course, all the Web is also based on Unicode, despite of support of non-Unicode encodings.

Web browsers usually directly support a good number of obsolete encodings via "HTTP-EQUIV" or "meta charset=…". Better don't buy it.

Here is my practical advice: transcode everything to UTF-8. This encoding does not waste space for characters which fall into the ASCII range and supports the full Unicode character repertoire. This encoding is byte-oriented, all characters with code points above 0xFF are expressed as 2 and more byte sequences; it does not depend on endianess of the system. Transcode all your content to UTF-8 offline, don't let it to sneak into your Web content.

Never use CP-1251 and forget about "translit", whatever it means (there are several different notions of "translit").

Now, it's possible that you have some text files in Croatian written in the some obsolete encodings, but you don't know what is that encoding, exactly. Here is the simplest detection tool: rename the file as .HTML and use the menu View -> Character Encoding (or similar item), and play with different encodings or use "auto-detect".

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900