1

Currently, I am working on a java desktop program that will generate letters in the Turkish language. I intend to generate a PDF letter with original Turkish letters in it, but somehow I keep a missing couple (not all) Turkish letters. An example letter that I am missing is ı (Turkish short i(?)).

When the code of mine generates a letter in Turkish - it deletes those Turkish letters that are not recognized. After changing encoding I was able to change those unrecognized letters into f.e 0 or 1 in .pdf letter of mine. I think I am badly stuck...

As was said before - I did try to change encoding. Still - during debugging I can see that those letters in their original look (within debug console). That confuses me only more.

Templates for letters are placed within OracleDb, and they are downloaded in perfect state.

Used PDF library is itext.

lugiorgi
  • 473
  • 1
  • 4
  • 12
Fishy_Code
  • 49
  • 8
  • 5
    It's hard to advise anything without seeing your code. – Krystian G Feb 04 '20 at 13:57
  • 1
    I find it hard to understand your problem and what you are doing. Since you've added the "html" tag - do you mean you're generating html first and transform that into pdf? What exactly are you building the pdf file with? How are you loading and transforming the data? Why don't you use utf-8 which should support _all_ Turkish characters? – Thomas Feb 04 '20 at 13:59
  • 2
    Indeed, How do you generate those reports? Which PDF library do you use? Or is it a home brew? – mkl Feb 04 '20 at 13:59
  • 2
    It could also be a font problem! If you can specify the font choose one that supports your characters. – lugiorgi Feb 04 '20 at 14:00
  • Font that i am using - Sans. First I do change String into HTML code that generates HTML paragraphs. The final .pdf letter of mine is combined of HTML paragraphs. Also - I am using ITextFactory – Fishy_Code Feb 04 '20 at 14:00
  • 1
    Check if that font supports turkish characters, maybe try another font (see https://stackoverflow.com/questions/22356993/google-webfonts-that-support-utf-8-turkish-characters) – lugiorgi Feb 04 '20 at 14:03
  • Will give it a shot, thanks. – Fishy_Code Feb 04 '20 at 14:05
  • @Fishy_Code How exactly do you use iText? Via `HTMLWorker`? `XMLWorker`? `HtmlConverter`? Do you provide fonts? Please share the pivotal code. – mkl Feb 04 '20 at 15:01

1 Answers1

0

It could either be an encoding problem or, if as you stated the encoding is correct, a font issue.

Not all fonts have glyphs for every character, so if you use a font that does not support said characters that will not work.

Check if your font supports your characters (see for example Google webfonts that support UTF-8 (Turkish) characters?) and use one that does.

A similiar c# issue can be found here itextSharp - html to pdf some turkish characters are missing.

lugiorgi
  • 473
  • 1
  • 4
  • 12
  • I saw this material. Tried to add those letters hardcoded, but without any effect - after generating letter it hadn't those letters. Encoding type if UTF-8. This is why I've decided to post this problem of mine. – Fishy_Code Feb 04 '20 at 14:15