Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

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 non-English character sets, such as Japanese or Russian, they are initially given as Unicode strings.

Here is an example with a Japanese character string:

  1. Allocate the destination string

  2. Convert the Unicode string to UTF8

    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 UTF8Char string, and the Japanese characters will be displayed correctly in the PDF file.

In Visual Studio, if a source file directly contains foreign characters, then the source file must be saved with a correct encoding, such as Unicode (UTF-8 with signature) - Codepage 65001.

  • No labels