Special character ok in HTML, not ok in PDF - freemarker

The below code in the template takes care that these special characters are printed ok when printed in HTML
?replace("≥", "≥")?replace("≤", "≤")
The result is:
Test special characters:
Greater_equal ≥
Less_equal ≤
When I change the output type from HTML to PDF, these characters are not printed anymore:
Test special characters:
Greater_equal
Less_equal
How canI make this work with PDF as output type?

For the one that could encounter same issue
I've had this issue recently and what I've found out is for some fonts there is not character set so it doesn't show greater than equal or other symbols.
However I've tried with Arial font and it's working even if you've added it like this: '≥'
Long story short, solution would be to update the font with the one that support.

Related

Is it possible to render zero-width unicode characters as a special replacement character with a custom font?

I'm trying to figure out a way to render certain unicode characters as a custom character instead of how they are supposed to appear.
For example, I would like the character U+0E4A to render as something else rather than how it currently appears in Windows.
I tried to create a quick custom font and to replace those glyphs but it only seems to work in some programs. My font will work correctly in LibreOffice Writer but it won't display properly in WordPad. Replacing regular letters works fine, but for other unicode characters they seem to revert back to a default way of rendering and don't display correctly.
Here is a screenshot of my custom font in WordPad, as you can see I made an obvious edit to the B character but I also did the same to the U+0E4A code point and yet it renders as normal.
If there is a special font that already does this that would probably save me the time of making a custom font, but either way I can't figure out how to render these characters as a custom character.

QTextDocument print to pdf and unicode

I try to print pdf file from QTextDocument. Content of document is set by setHtml().
Simplified example:
QTextDocument document;
document.setHtml("<h1>My html \304\205</h1>"); // Octal encoded ą
QPrinter printer(QPrinter::HighResolution);
printer.setPageSize(QPrinter::A4);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName("cert.pdf");
document.print(&printer);
It does not work as expected on windows (msvc). I get pdf file with "?" in place of most polish characters. It works on ubuntu.
On windows It makes pdf with tahoma font embedded subset. How to force QPrinter or QPrintEngine to embed more characters from this (or any other) font?
As pepe suggested in comments. I needed to wrap this string one of:
QString::fromUtf8
tr() (in case of joining translated parts)
Use html escape sequence (ex. &#261 for ę)
My original html in program was build from tr() parts, but I forgot to octal escape some of them. (which worked on gcc, not on msvc, even with utf-8 with BOM)

Arabic-English Transliteration using unsupported font

I am working on language transliteration for Ar and En text.
Here is the link which displays character by character replacement : https://github.com/Shnoulle/Ar-PHP/blob/master/Arabic/data/Transliteration.xml
Now issue is:
I am dealing with font style robert_bold.ttf and robert_regular_0.ttf which has some typical characters with underline and overline as in this snap
I have .ttf file so I can see this fonts on my system. But in my application or in above Transliteration.xml characters are considered as junk like [, } [ etc.
How can I add support of this unsupported characters in Transliteration.xml file?
<pair>
<search>ي</search>
<replace>y</replace>
</pair>
<pair>
<search>ى</search>
<replace>a</replace>
</pair>
<pair>
<search>أ</search>
<replace>^</replace> // Here is one of the character s_ (s with underscore not supported)
</pair>
It seems that the font is not Unicode encoded but contains the underlined letters at some arbitrarily assigned codes. While this works up to a point, it does not work across applications, of course. It works only when that specific font is used.
The proper way is to use correct Unicode characters such as U+1E0F LATIN SMALL LETTER D WITH LINE BELOW “ḏ” and, for rendering, try to find fonts containing it.
An alternative is to use just basic Latin letters with some markup, say <u>d</u>. This means that the text must not be treated as plain text in later processing, and in rendering, the markup should be interpreted as requesting for a line under the letter(s).

Does Google Chart support UTF-8 Characters?

I have title and labels with unicode labels in Google Chart, but they are not being displayed properly.
Here's an example: http://chart.apis.google.com/chart?chs=300x225&cht=p3&chco=344566,C4C4C4&chds=0,90&chma=70,70&choe=UTF-8&chtt=Test&chd=t:27933485,20611682,34172068&chl=Un%E9%A7%85xbr%E1%83%A6cker|Test1|Test2
Characters do not appear right as you see.
Is there a way to make google charts display utf-8 characters properly? I've tried many things but nothing worked for me.
The problem appears to be the unicode codepoints (E9A785 -> 99C5 and E183A6 -> 10E6) that you are providing. These characters do not appear to be displayed in a google chart. Experiments with other codepoints (specifying them as UTF-8 in the same format as your query) appear to work fine.
The particular characters in your example (the first is from the CJK Unified Ideograms and the second from Georgian) are a little strange. You might want to double check that they are correct.

Encoding issues with Microsoft Word characters in an AJAX request

I'm writing a function to convert MS Word-styled text into Adobe InDesign-formatted text (it uses a kind of XML to indicate styling). The text is pasted into a TinyMCE rich text editor, which then sends the HTML-formatted code to a php function.
I've tried this function to clean up the code once it reaches my conversion code:
$text = iconv("windows-1250", "UTF-8", $html);
When I use any 'special' kind of characters, things go wrong. £ signs, é (or any other accents), and a variety of 'curly' apostrophes/quote marks seem to break things. For example, if I try to convert a £ sign, the code returns \u0141, but I get the Ł symbol displayed onscreen when the function returns.
Does anybody know what I can do to prevent Word's weird characters breaking everything I'm doing?
I seem to have fixed this. I was using escape() to pass the values, but replaced this with encodeURIComponent() instead (and removed the iconv() call in my php code), which seems to have fixed it.

Resources