![]() ![]() ![]() Int StrCiCmp(const char* s1, const char* s2)Ĭhar* StrCiStr(const char* s1, const char* s2) Int StrnCiCmp(const char* s1, const char* s2, size_t ztCount) Unsigned char* StrToLwrExt(unsigned char* pString) unsigned char* StrToUprExt(unsigned char* pString) (separate answer below, answer space) This function covering the case sensitive character sets in the UTF8 and how to use it for cmp. ![]() It is supposed to be correct (if any bugs are found please tell). This code is a carefully tested UTF8 case conversion/case insensitive cmp. I'd love some guidance if you could shed some light on either what I'm doing wrong or why my question/premise is faulty! Calling setlocale to either UTF-8 or ISO8859-1 doesn't appear to change the outcome. Also, this Ideone example I put together seems to show that toupper() of 0xc3b3 is just 0xc3b3, which is an unexpected result. I was expecting to just use something like std::toupper(), but the usage is really unclear to me because it seems like I'm not just converting one character at a time but an entire string. It also appears that this problem can be very "tricky" in that the output might be dependent upon the user's locale. There are some examples on StackOverflow but they use wide character strings, and other answers say you shouldn't be using wide character strings for UTF-8. The original byte sequence in the string is 0xc3b3c3b3 (two bytes per character, and two instances of ó) and I'd like the output to be 0xc393c393 (two instances of Ó). Ideally I want the uppercase/lowercase approach I'm using to be generic across all of UTF-8. Let's imagine I have a UTF-8 encoded std::string containing the following:Īnd I'd like to convert it to the following: ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |