Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In Hoops This article demonstrates how to display foreign characters in a PDF file by converting a Unicode string to a UTF8Char string.

In the HOOPS Publish API, every character string must be given as A3DUTF8Char*. However, when dealing with foreign characters character sets, such as Japanese or Russian ones, they are initially given as Unicode strings.

This article is showing how to convert Unicode strings to UTF8Char strings, to display foreign characters in a PDF file.

Here is an example with a Japanese character string:

  1. Allocate the destination string

  2. Convert the Unicode string to the UTF8 one

    Code Block
    wchar_t sString[] = L"新細明體";
    A3DUTF8Char* pcDestString = new A3DUTF8Char[500];
    A3DMiscUnicodeToUTF8((const A3DUTF8Char*)sString, pcDestString );

Now pcDestString can be used in any function or field data requiring a UTF8 UTF8Char string. And , and the Japanese characters will be displayed correctly in the PDF file.

...