updating C code for utf8 strings—help with mbtowc()
Hi—
I manage a small community server which hosts a local chat program originally written by one of our users about 13 years ago. The last significant update was December of 2001. I am now wading through the code trying to adapt it to handle utf8 locales (and cleaning up other obsolescences in the process). In the process, I hope to allow extended typographical characters, too. I am stuck on the isalnum() function. Globalyzer says ANSI does not provide an ismbalnum(), so one must convert a multibyte character to wide using mbtowc() and then use iswalnum(): Code:
#include <stdlib.h> Code:
if (isalnum(testchar) { Code:
wchar_t widetestchar; Thanks— q. (o, and I'm aware that there are plenty of modern chat programs already written that I could install instead. That won't fly here.) |
Quote:
You want Code:
wchar_t widetestchar; Code:
char testchar[TEST_SIZE]; Code:
char testchar; |
Doh!
I must have read right over the description of the return codes half a dozen times yesterday and it completely failed to register. Thanks so much for your quick and helpful response. ----q. |
Quote:
Quote:
|
All times are GMT -5. The time now is 02:03 AM. |