From c6cd2f1f164baac1414f2cf658566de146b10552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 23 Jul 2022 18:59:37 +0200 Subject: Fix display of Unicode text. Turns out that SWI-Prolog's wide string functions, which I started using in 03fe361, do not convert between narrow Prolog atoms and wide C strings, as I mistakenly thought. Instead, they work with wide Prolog atoms. In hindsight, it is not surprising. --- c/datalistview.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'c/datalistview.cpp') diff --git a/c/datalistview.cpp b/c/datalistview.cpp index b728fa8..1ceeb3b 100644 --- a/c/datalistview.cpp +++ b/c/datalistview.cpp @@ -57,21 +57,21 @@ void DataListView::ShowEpisode(const int iEpisode) PL_predicate("episode_datum", 3, "episode_data"), t); for (int i = 0; PL_next_solution(q); i++) { - TCHAR* tszKey; - TCHAR* tszValue; + std::basic_string tstrKey; + std::basic_string tstrValue; - if (!(PlGet(t+1, &tszKey) && PlGet(t+2, &tszValue))) + if (!(PlGet(t+1, &tstrKey) && PlGet(t+2, &tstrValue))) continue; lviKey.mask = LVIF_TEXT; lviKey.iItem = i; lviKey.iSubItem = 0; - lviKey.pszText = tszKey; + lviKey.pszText = tstrKey.data(); ListView_InsertItem(hWnd, &lviKey); lviValue.iItem = i; lviValue.iSubItem = 1; - lviValue.pszText = tszValue; + lviValue.pszText = tstrValue.data(); ListView_SetItem(hWnd, &lviValue); } -- cgit v1.2.3