💾 Archived View for gemini.turnquist.name › gemlog › 2023101521_nCurses__foiled_again.gmi captured on 2024-05-10 at 10:42:35. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-11-04)
-=-=-=-=-=-=-
I've been working for about a week trying to update my C gemini client to use the ncursesw library so it will support UTF-8 encodings. Everything I found online showed it to be very simple: make sure you call setlocale() first thing, and link with -lncursesw (instead of -lncurses). Simple enough.
But I experienced the most bizarre bugs when I did that. Now the program only recognised the first 20 columns of an 80 column display, and any attempt to fix that broke something else. Nothing online even suggested this had happened to anyone else.
Finally, it took just the right incantation on StartDuckDuckGooglePage, and found a sole mention on Stack Overflow (IIRC).
Ncurses is actually several libraries. There's the main libncurses that is always used. But then there are auxiliary libraries that can be used if needed (panel, menu, and form). All of these also have a version ending in 'w'. But nowhere in the man pages is that mentioned.
I uses libpanel in my client (right now mainly for the help window, but possibly other uses). I was linking with "-lpanel -lncursesw". That works only slightly better than linking with an x86_64 library and and arm library. They're not compatible.
Once I changed to linking with "-lpanelw -lncursesw", like magic, everything suddenly worked, and I could go back to fixing real bugs in *my* code.
So bottom line: make sure to use all curses libraries ending in 'w' or use none of them (and miss easy support for UTF-8).
--Andrew
;Date: 2023-10-15 21:16 ;Desc: Don't forget -lpanelw (and possibly -lmenuw or -lformw) ;Tag: C ;Tag: curses ;Tag: ncursesw ;Tag: UTF-8