IBM Support

Unicode characters are not shown correctly only for PDF reports; no issues in HTML reports

Troubleshooting


Problem

Extra fonts are added and used for a report to add support for special Unicode characters. The characters show correctly in HTML and Excel reports, but not in PDF reports.

Symptom

In PDF reports, certain characters do not show properly. The following can occur:
  • Unintended glyphs such as squares or other characters are displayed.
  • Characters do not display at all.
  • A box with the Unicode encoding number is displayed.
The issue occurs only for PDF reports; these characters maybe seen correctly on HTML and Excel reports.
image-20220607131721-1

Cause

  • Fonts were not installed and configured correctly, which prevents the font from being embedded into the PDF.
  • Document requires more than one font, which requires more configuration.
PDF reports treat font names as case-sensitive, and are more strict in font handling.
In contrast, browsers and applications are inherently more resilient to font errors.
  • By default, CSS styles used in displaying HTML reports includes multiple fonts, allowing at least one font to show the glyph.
  • CSS treats font names case-insensitively. For more details, view the following documentation: CSS Fonts Module Level 3 (w3.org)
  • Windows application (such as Excel) can benefit from Windows' font fallback feature, which allows other fonts to be used automatically when a particular font doesn't have the required glyphs. For more details, view the following Microsoft documentation on font fallback and composite fonts: FontFamily Class (System.Windows.Media) | Microsoft Docs

Environment

Cognos 11.1.7

Diagnosing The Problem

To diagnose the problem, it is necessary to confirm if the required characters exist in the fonts currently in use.
View the data in a hex editor and confirm the Unicode encoding
Download and view the data in a hex editor. If required, export the text to a text file so it can be viewed in the hex editor.
Find the character that was displayed incorrectly. Using the hex editor's features, view the Unicode value.
The following is an example of this being done by using HxD hex editor.
image-20220607122658-9
Use a third-party character map application to confirm that the required character exists in the font
With the Unicode value captured, verify that the font being used contains the character required by using a character map application.
Windows Character Map is a tool built into Windows that can be used to find characters in a font. Enter the character Unicode value into the search box. Alternatively, the character can be found in the list; the selected character's Unicode encoding value is shown on the lower left of the application.
image-20220607123355-11
However, Windows Character Map does not support Unicode value higher than U+FFFF. To view other characters, other tools such as BabelMap can be used. If BabelMap is used, ensure to choose the Single Font option, and select the font used from the dropdown menu. Enabling this option displays characters only from that font, rather than from multiple fonts.
image-20220607140324-1
If the character does not exist in the font, install and apply another font that has the character, and try running the PDF report again.
If the character does exist, continue with the steps that follows.

Resolving The Problem

Ensure that the font is installed correctly
For reports such as HTML and Excel, font names are not case-sensitive. However, in PDF reports font names are case-sensitive.
  1. Check the name of the font by using one of the methods as follows:
    1. In Windows, double-click the font to open it in Windows Font Viewer, then check the "Font name" entry.
      image-20220607132212-3
    2. In Linux, use fc-list command to view the font name.
    3. Open Cognos Configuration, then select Environment from the Explorer side bar.
      Select "Physical fonts map" and click the Edit button ("pencil" icon).
      Click "Add..." button.
      Click the Physical Font Name box, then click the Edit button.
      Click "Search Now" button.
      Find the font name from the list.
      image-20220607132303-4
  2. Open Cognos Configuration, go to the menu option Actions -> Edit Global Configuration..., then go to the Fonts tab and click "Add..." Ensure that the font name is entered correctly, as this setting is case-sensitive. A restart is required to apply the changes.
For more details, view the following documentation: Add Fonts to the IBM Cognos Environment
Ensure that the font is applied
Ensure that the required font is selected in the object properties in report design. For more details, view the following documentation: Specify the font for a report
image-20220607132351-5
Multiple fonts are required to display all characters
The report might be using characters from multiple fonts, and the PDF report requires all fonts to show all characters correctly.
For example, the report might be using characters from both private-use characters range and CJK Unified Ideographs Extension B, and needs one font for the private-use range, and another font for Extension B.
To use two fonts, the default font for PDF reports can be changed.
  1. Identify all fonts required to display all characters. Assign one of the fonts of to the report design, as described in the earlier steps.
  2. Assign the second font as the default font for PDF reports.
    Open Cognos Configuration, go to the menu option Actions -> Edit Global Configuration... then go to the General tab.
    Enter the required font name under Default Font (case-sensitive).
    For more details, view the following documentation: Change the default font for PDF reports

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSTSF6","label":"IBM Cognos Analytics"},"ARM Category":[{"code":"a8m500000008d78AAA","label":"Reporting"}],"ARM Case Number":"TS008520837","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1.7"}]

Document Information

Modified date:
07 June 2022

UID

ibm16592969