Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
README | 2012-07-09 | 1.2 kB | |
stringW32.zip | 2012-07-09 | 2.6 kB | |
Totals: 2 Items | 3.8 kB | 0 |
------ From the mail sent by Chris Mürwald, chris at activeworlds .com --------- Attached is a small code sniplet useful for character converting from wide characters to and from encoded character sets. As most dictionaries use character sets in their native code page, such conversion routines are extremely useful, in particular when dealing with Unicode applications on Windows. As Windows usually does not deal with string representation for code pages, I made an attempt to convert them into code page identifiers, included in the code sniplet. Example usage: #define DICT_MAX 2 Hunspell* m_pHunSpell[DICT_MAX]; TextParser* m_pHSTxtParser[DICT_MAX]; char* m_dicEnc[DICT_MAX]; UINT m_codePage[DICT_MAX]; m_pHunSpell[d] = new Hunspell (aff, dic, NULL); dic_enc = m_pHunSpell[d]->get_dic_encoding(); m_codePage[d] = string_getCodePage(dic_enc); // ... later in your program, when putting a wchar_t* into the parser: m_pHSTxtParser[d]->put_line (string_from_unicode_cp(text, m_codePage[d])); // ... or when getting suggestions: wchar_t* suggest = string_to_unicode_cp(wlst[i], m_codePage[d]);