Sign in Join
Wiki copytemporary

iconvenc

The iconvenc package is a header file for the POSIX iconv posix library on Unix. Note that currently we try to keep this header portable, so GNUisms are not allowed. A simple Pascal wrapper to do a string conversion is also added.

Buffering

While creating the header, some confusion arose over the fact that the library didn't always seem to write the last few chars. This turned out to be a buffering in the iconv lib, which isn't really spellled out in the man pages (though the below URLs do mention it cryptically).

The lib does autoflushed if the input string is 0 terminated (IOW if the count of chars to be passed is strlen(pchar)+1 or length(ansistring)+1), but an additional iconv(nil,nil,dest,outcharcount); will flush the buffer. (see the iconvert routine)

Credits

Thanks to Thomas Schatzl for his help solving the autoflushing issue, also thanks for Ido Kanner for helping with the testing setup, and Micha Nelissen and Ales Katona for minor help and testing.

linking method

The header file allows both dynamic as static linking, with static being the default. {$define loaddynamic} to make it try multiple libraries. A function to try additional library names is also provided.

Naming

The unit is called iconvenc because the main function already is named iconv.

URLS


From the Free Pascal wiki, page "iconvenc", as it stood on 2013-04-30 after a change by Jwdietrich, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.