For dealing with ASCII we have strlen, strcat etc..
For UTF16(i.e, UCS2) we have wcscat and wcslen functions.
For dealing with UTF8 and UCS4 what are the functions available in C?
Assume Linux/gcc
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t think standard C libraries have UTF-8 functions. There are surely libraries for it.
However, normal str functions can be used with UTF-8 in many cases.
strlenworks well, returning the number of bytes (not characters).strcatworks (it also overruns your buffer easily, but this is normal for strcat).The reason is that the 0 character can’t appear in multi-byte UTF-8 data. So if it appears in a UTF-8 string, it’s surely its end, just like in ASCII.