Xerces トランスコードが空の文字列を返しています。ロケールの問題に関連していると思いますが、行き詰まっています。
私はこの簡単なプログラムを持っています:
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/framework/MemBufInputSource.hpp>
#include <xercesc/dom/DOMException.hpp>
#include <string>
#include <stdio.h>
XERCES_CPP_NAMESPACE_USE
using namespace std;
int main(int argc, char* argv[])
{
string a = "Não";
try
{
XMLPlatformUtils::Initialize("pt_PT");
} catch(const XMLException& e)
{
fprintf(stdout,"ERROR INITIALIZING\n");
}
XMLCh *auxCh3 = XMLString::transcode(a.c_str());
fprintf(stdout,"### %s ###\n",XMLString::transcode(auxCh3));
XMLString::release(&auxCh3);
XMLPlatformUtils::Terminate();
return 0;
}
結果は次のとおりです。
「######」
ã を削除すると、結果は OK です。
"### いいえ ###"
サーバーのロケールは次のように定義されています。
[]$ locale
LANG=pt_PT
LC_CTYPE="pt_PT"
LC_NUMERIC="pt_PT"
利用可能なものはどれですか:
[]$ locale -a|grep pt_PT
pt_PT
ご協力いただきありがとうございます。