problem converting ucs2 to utf8
От | W. de Hoog |
---|---|
Тема | problem converting ucs2 to utf8 |
Дата | |
Msg-id | 523DC699.8060509@exalondelft.nl обсуждение исходный текст |
Список | pgsql-odbc |
Hi, I am trying to connect postgres to mono on ubuntu 64 bits. There is a problem when converting wchar data from a bound parameter. The call to ucs2_to_utf8 in convert.c always fails. Doing some mylog stuff I noticed the passed parameters behave weird. The output of (wj is an int). mylog("wj C_WCHAR=%s used=%d, WCLEN=%d\n", buffer, used, WCLEN); mylog(" used stuff: %d:%d:%d\n", used > 0, used / WCLEN, used > 0 ? used / WCLEN : used); wj = used; mylog(" more used stuff: %d:%d:%d\n", wj > 0, wj / WCLEN, wj > 0 ? wj / WCLEN : wj); is [140667133007808]wj C_WCHAR=b used=-3, WCLEN=2 [140667133007808] used stuff: 1:2147483646:2147483646 [140667133007808] more used stuff: 0:-2:-3 so ucs2_to_utf8 does not alloc any space and the operation fails. When I change the call to buf = allocbuf = ucs2_to_utf8((SQLWCHAR *) buffer, wj, &wj, FALSE); used = wj; it seems to work. Anybody an idea what went wrong with the content of the 'used' variable here? regards, -- Willem-Jan de Hoog
В списке pgsql-odbc по дате отправления: