iconv madness
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CAHt6W4fYxDxrvHvMXUOtmH13YRGi88NwKgJRvrj-46S4eipPMA@mail.gmail.com> |
Hi, I'm going probably to refactor a bit the iconv stuff. 1- remove of the double conversion. Some iconv implementations does not allow conversions freely from any charset to any other allowing mainly conversion from/to a specific charset (ie ucs4 or ucs2). These environment will have to use GNU libiconv. The code to handle it is quite ugly and not tested anymore and was only introduced to handle HP-UX. It would be good to have a test program or better a test in configure.. I'll see what I can do 2- remove tds_iconv in favour of tds_convert_stream. There are mainly 3 functions that convert a string in chunks: tds_iconv, tds_convert_stream and tds_put_string. read_and_convert was another but was converted to use tds_convert_stream. tds_put_string will be converted to use tds_convert_stream too. Now mostly conversion would go through tds_convert_stream and tds_iconv which both do conversion in chunks. This cause a lot of strange errors and code is quite complicated. A single function will make things easier and faster. The result function will be quite complicated but no more than tds_iconv now! 3- other uses could be easily be converted to use tds_convert_stream (probably with a simple interface) 4- tds_get_char_data and callers... well... a strange mix that probably could be simplified making more dynamically. tds_get_char_data already handle binary data and BLOBs, it's not clear who handle column data. Yes, code is actually a lot complicated. Some refactoring are needed. Row handling is ugly too. Frediano