lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 09/03/12 15:00, Ignacio Burgueño wrote:

On Fri, Mar 9, 2012 at 12:00 PM, Scott Morgan <blumf@blueyonder.co.uk <mailto:blumf@blueyonder.co.uk>> wrote:

    On 09/03/12 12:32, Ignacio Burgueño wrote:

        This version handles SQL_WCHAR, SQL_WVARCHAR and
        SQL_WLONGVARCHAR. I needed to add them some time ago when
        dealing with nchar, nvarchar and ntext columns in SqlServer.


    How do you transcribe between the 16-bit and 8-bit charsets? Do
    you just convert to UTF8 or local codepage?


I don't. I found that I sent this same patch three years ago. Sadly, the luaforge site is no more, so the bug report [1] is lost (I think).

The call to SQLGetData converts the strings from unicode but I don't recall the exact details. This sure is no definitive solution. At the time, I thought about returning the strings unmodified and let the user do what's needed (convert to utf-8 using some library, whatever).

From what I can make out LuaSQL asks for the SQL_WCHAR data in SQL_C_CHAR form, so the ODBC driver should encode them in the machines local codepage. Not ideal if you want something outside of that (don't think I've ever had success trying to get the UTF8 codepage 65001 working), but better than nothing I guess.

I'll merge it.

Scott