logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marshall Powers" <mpow...@appsecinc.com>
Subject RE: Problem with iconv charsets...
Date Mon, 25 Jun 2007 16:48:41 GMT
The string literal "ISO-8859-1" appears in APR and log4cxx source code. For
example, from apr-1.2.7/misc/unix/charset.c:

APR_DECLARE(const char*) apr_os_default_encoding (apr_pool_t *pool)
#ifdef __MVS__
#    ifdef __CODESET__
        return __CODESET__;
#    else
        return "IBM-1047";
#    endif

    if ('}' == 0xD0) {
        return "IBM-1047";

    if ('{' == 0xFB) {
        return "EDF04";

    if ('A' == 0xC1) {
        return "EBCDIC"; /* not useful */

    if ('A' == 0x41) {
        return "ISO-8859-1"; /* not necessarily true */

    return "unknown";

Also, in log4cxx/src/charsetencoder.cpp:

CharsetEncoderPtr CharsetEncoder::getEncoder(const std::string& charset) {
    if (StringHelper::equalsIgnoreCase(charset, "US-ASCII", "us-ascii") ||
        StringHelper::equalsIgnoreCase(charset, "ISO646-US", "iso646-US") ||
        StringHelper::equalsIgnoreCase(charset, "ANSI_X3.4-1968",
"ansi_x3.4-1968")) {
        return new USASCIICharsetEncoder();
    } else if (StringHelper::equalsIgnoreCase(charset, "ISO-8859-1",
"iso-8859-1") ||
        StringHelper::equalsIgnoreCase(charset, "ISO-LATIN-1",
"iso-latin-1")) {
        return new ISOLatinCharsetEncoder();
    } else if (StringHelper::equalsIgnoreCase(charset, "UTF-8", "utf-8")) {
        return new UTF8CharsetEncoder();
    } else if (StringHelper::equalsIgnoreCase(charset, "UTF-16BE",
        || StringHelper::equalsIgnoreCase(charset, "UTF-16", "utf-16")) {
        return new UTF16BECharsetEncoder();
    } else if (StringHelper::equalsIgnoreCase(charset, "UTF-16LE",
"utf-16le")) {
        return new UTF16LECharsetEncoder();
#if defined(_WIN32)
    throw IllegalArgumentException(charset);
    return new APRCharsetEncoder(charset.c_str());

Are these files generated by configure scripts/ant build files? It doesn't
seem like they are...

-----Original Message-----
From: dev-return-18563-mpowers=appsecinc.com@apr.apache.org
[mailto:dev-return-18563-mpowers=appsecinc.com@apr.apache.org] On Behalf Of
William A. Rowe, Jr.
Sent: 2007-Jun-25 Mon 12:33 PM
To: Marshall Powers
Cc: dev@apr.apache.org; 'Log4CXX User'
Subject: Re: Problem with iconv charsets...

Marshall Powers wrote:
> I'm trying to use APR-1.2.7 in Log4Cxx 0.10 on AIX 5.3. When I run my
> program, I get an exception "APR_LOCALE_CHARSET" in the
> method. I think this problem is related to the iconv that is installed on
> this machine. When I run iconv -l, among the various charsets I see
> "ISO8859-1". However, in the source for Log4Cxx and APR, the only string
> literals I see are for "ISO-8859-1" (note the extra dash). Is there any
> simple way to work around this problem? Is this potentially a portability
> issue with APR/log4cxx (that is, if I distribute some app that uses APR,
> my user doesn't have "ISO-8859-1" in their iconv, is my app going to

Unfortunately, aliases are within the domain of iconv.

The question is, where did it pull out "ISO-8859-1" from as the default
locale on your box?  If *that* is from apr-util, we need to unwind where
it was resolved.  If that was an envvar set on your login, well, that would
be called shooting oneself in ones foot.

View raw message