On Mon, 27 Mar 2000 12:55:34 +0100, Juergen Hermann wrote:

>I have the following problem using the xerces-c_1_1_0-linux binary
>distribution:

And I've found the solution. I did not initialize the locale as in the
following code, resulting in "-1" returns from wcstombs(). The whole thing
might be worth an entry in the FAQ.

    // initialize locale
    char* currentLocale = setlocale(LC_ALL, "");
    if (currentLocale)
    {
        std::cerr << "Locale set to '" << currentLocale << "'" << std::endl;
    }
    else
    {
        std::cerr << "Unable to set locale!" << std::endl;
    }

    // initialize Xerces
    try
    {
         XMLPlatformUtils::Initialize();
    }
    catch (const XMLException& toCatch)
    {
        std::cerr << "Error during initialization! :\n"
            << CXMLTranscode(toCatch.getMessage()) << std::endl;
        exit(EXIT_FAILURE);
    }

BTW, the -1 return from wcstombs() is more or less silently ignored in
IconvLCPTranscoder::calcRequiredSize(). I think raising an exception should be
considered here.



Ciao, Jürgen

--
Jürgen Hermann ([EMAIL PROTECTED])
WEB.DE AG, Amalienbadstr.41, D-76227 Karlsruhe
Tel.: 0721/94329-0, Fax: 0721/94329-22


Reply via email to