apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert Chin <apr-...@mlists.thewrittenword.com>
Subject apr_xlate_open() problem on Solaris 8/SPARC
Date Mon, 05 Jun 2006 23:25:24 GMT
I've built apr-0.9.11 and apr-util-0.9.11 on Solaris 8/SPARC with the
Sun C compiler. I'm using GNU libiconv() so APU_HAVE_ICONV is defined.

$ cat a.c
#include <stdio.h>
#include <stdlib.h>

#include <apu.h>
#include <apr_xlate.h>

main (void) {
  apr_pool_t *pool;
  apr_xlate_t *handle;
  apr_status_t apr_err;

  apr_initialize ();
  apr_pool_create (&pool, NULL);

  apr_err = apr_xlate_open (&handle, APR_LOCALE_CHARSET, "UTF-8", pool);

  if (APR_STATUS_IS_EINVAL (apr_err) || APR_STATUS_IS_ENOTIMPL (apr_err))
    handle = NULL;
  else if (apr_err != APR_SUCCESS)
    exit (1);

$ cc -g a.c -laprutil -lapr
$ ./a.out
$ echo $?

I dug into apr_xlate_open() and, when APR_LOCALE_CHARSET is passed,
frompage == apr_os_locale_encoding(). From
apr-0.9.11/misc/unix/charset.c, apr_os_locale_encoding() will use the
charset returned by nl_langinfo(CODESET). On Solaris it is "646". So,
we want a conversion from "646" to "UTF-8". However, iconv_open()
errors out in this case.

Trying the native Solaris iconv_open() for a conversion from "646" to
"UTF-8" seems to work though. Is this the recommended iconv
implementation for this platform?

Should I be using apr-iconv instead of GNU libiconv?
include/apu.h.in seems to have:
  #define APU_HAVE_APR_ICONV     0

albert chin (china@thewrittenword.com)

View raw message