Open pali opened 4 years ago
@lurcher I see that you already implemented it. That was fast, thank you!
Now I'm looking at the code ...
https://github.com/lurcher/unixODBC/blob/99554059180cdf9ae98dadbc245f340c9ce18502/exe/odbc-config.c#L122
https://github.com/lurcher/unixODBC/blob/99554059180cdf9ae98dadbc245f340c9ce18502/exe/odbc-config.c#L126
... and you forget here to quote "%s"
. So they exapand to #define UNICODE_ENCODING auto-search
which is not valid.
Because ASCII_ENCODING
and UNICODE_ENCODING
macros are strings, you need to write their values into qutoes, so:
printf( "#ifndef ASCII_ENCODING\n #define ASCII_ENCODING \"%s\"\n#endif\n", ASCII_ENCODING );
printf( "#ifndef UNICODE_ENCODING\n #define UNICODE_ENCODING \"%s\"\n#endif\n", UNICODE_ENCODING );
After that expansion would be properly quoted: #define UNICODE_ENCODING "auto-search"
Currently it is not possible to check for compile time encoding options in application which uses unixODBC. It would be nice if application would be able to check if unixODBC was compiled with --iconvperdriver=yes or not and what are --with-iconv-char-enc= and --with-iconv-ucode-enc= options.
I would propose to export these 3 options to unixodbc_conf.h file which is generated at compile time. So applications would be able to get these data if it needs it. This header file already contains SQL_WCHART_CONVERT define, so encoding compile options could be put there too.