kstrauser/pgdbf — pull request #1 by philwo (2012-03-01 02:19:58+00:00)
Title: Character set recoding of input data to UTF-8 using iconv

Hi,

while trying to convert the dBase IV files (arghhh...) of a Japanese school library management software to PostgreSQL, I stumbled upon your software, pgpdf. It's awesome. Actually, it's the only dBase library / tool I found, that was able to read my files (dBase IV w/ memo seems to be unsupported mostly).

While importing, I had problems resulting from the use of Shift-JIS X0213 character encoding in the database file and UTF-8 in PostgreSQL. I tried to simply pipe it through iconv, but as the ¥ and \ symbols are mapped to the same code point in that encoding, all escape sequences got messed up. I couldn't think of a quick way to fix that, without probably losing data in the conversion, so I decided to implement character set recoding using iconv directly in pgpdf to solve that problem in a clean way. Here's my result - I'd be happy if you'd consider including it in the main version of pgpdf.

I'm not used to writing man pages or working with autoconf / automake - but I tried hard to make the code behave well even if iconv is not available.

Thanks,
Philipp