[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Wide characters and menu
From: |
Юрий Дмитришин |
Subject: |
Wide characters and menu |
Date: |
Wed, 11 Jan 2012 05:19:35 +0200 |
Hello.
I have a database (PostgreSQL) with tables stored in Unicode (Cyrillic).
Seems my code doesn't work when I try to use output of the database query as menu items. Here's a code:
#include <ncursesw/panel.h>
#include <ncursesw/menu.h>
#include <wchar.h>
...
PGconn *connect;
connect = PQconnectdb(ConnectionString);
PGresult *OrderData;
OrderData = PQexec(connect, Query);
my_items = (ITEM **)calloc(PQntuples(OrderData)+1, sizeof(ITEM *));
for(i = 0; i < PQntuples(OrderData); ++i) {
my_items[i] = new_item(PQgetvalue(OrderData, i, 1), "");
};
my_menu = new_menu((ITEM **)my_items);
...
Compile: gcc 1.c -lmenu -lncursesw -lpq
So, with parameter PQgetvalue(OrderData, i, 0) my function works fine because this column is 'id'. But result of PQgetvalue(OrderData, i, 1) contains cyrillic symbols and my code doesn't work.
Regards, Yuriy Dmitrishin.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Wide characters and menu,
Юрий Дмитришин <=