The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Anyone using "Apache Portable Runtime" (APR) ?


I'm looking for a portable iconv library.  GNU have one in libiconv, as does the Apache Portable Runtime project.  I prefer the APR at the moment as it seems they do have the emphasis on Portable, and I also prefer the licensing model over the GPL/LGPL for this particular purpose.

However, the docs associated with it seem very sparse, and I'm having trouble getting it to do anything meaningful.  Even getting

apr_iconv_open("UTF-16","UTF-8",context,pool) (or whatever the extra arguments are)

doesn't seem to work.

I'm honing in on the idea that I need to force the necessary modules to be loaded, perhaps with apr_iconv_mod_load, but I'm really scratching around.  I also saw some stuff that inferred that apr_iconv was "internal", and that the apr-util\xlate code should be used as a wrapper instead, but I didn't see anything in there that jumped out at me as being that different.

So, I was wondering if anyone had successfully used this.  I have a cross platform (multiple unix flavours) app, which I will be using iconv in, but it's present on all my unix platforms.  I need something for Windows support.

I have all the apr-* stuff building nicely, I just can't get it to acutally run any conversions.  Any pointers would be great, as would any recommendations for any other possible solutions.
Looking for iconv...
Thursday, August 28, 2008

Disclaimer: I've not worked with apr-iconv or apr-util/xlate.

My understanding is that apr-util/xlate determines if there is a native iconv implementation at compile time and if so uses it, otherwise it uses apr-iconv. (./configure determines all this and puts it in apu.h)

In any case, after you use apr_iconv_open(), you need to use apr_iconv() to actually convert a buffer. Similarly, if you use apr-util/xlate you would need to use apr_xlate_conv_buffer() after apr_xlate_open().
Andrew Austin Send private email
Thursday, August 28, 2008
Thanks for the reply.  I was OK with the part about it testing for an existing iconv or using the internal one.  I was making a step by step comparison with a small iconv program I had on Linux, that was working fine.

I was able to solve my problem though - there is an environment variable called APR_ICONV_PATH, that must point to a directory containing the individual modules that actually do the conversion.  I'd mistakenly got the impression that the modules themselves also all got rolled into a dll, that the program already depended on.  That's not the case though - they just sit in a directory.

Just thought I'd post back in case it ever helps anyone else.
Looking for iconv...
Friday, August 29, 2008

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz