#include "ACEXML/common/Transcode.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_main.h"
Go to the source code of this file.
Function Documentation
Definition at line 30 of file Transcoder_Test.cpp.
{
ACEXML_UTF16 org [18];
ACEXML_UCS4 temp = 1;
ACE_OS::memset (org, 0, sizeof org);
size_t x;
for (x = 0; temp < 0x10000; x++, temp <<= 1)
{
org[x] = static_cast<ACEXML_UTF16> (temp);
}
ACE_DEBUG ((LM_DEBUG, "Original UTF16 string:\n"));
dump_utf16 (org, x);
ACE_DEBUG ((LM_DEBUG, "\n\n"));
ACEXML_UTF8 decoded [MAXPATHLEN];
ACE_OS::memset (decoded, 0, sizeof decoded);
ACEXML_Transcoder::utf16s2utf8s (org, decoded, MAXPATHLEN);
ACE_DEBUG ((LM_DEBUG, "Transcoded UTF8 string:\n"));
ACE_HEX_DUMP ((LM_DEBUG, decoded, ACE_OS::strlen (decoded) + 1));
ACE_DEBUG ((LM_DEBUG, "\n\n"));
ACEXML_UTF16 after [18];
ACE_OS::memset (after, 0, sizeof after);
ACEXML_Transcoder::utf8s2utf16s (decoded, after, 18);
ACE_DEBUG ((LM_DEBUG, "Restored UTF16 string:\n"));
dump_utf16 (after, x);
ACE_DEBUG ((LM_DEBUG, "\n\n"));
return 0;
}