* Test if a string is encoded as UTF-8. * * @param pabyData input string to test * @param nLen length of the input string, or -1 if the function must compute * the string length. In which case it must be null terminated. * @return TRUE if the string is encoded as UTF-8. FALSE otherwise * */
| 498 | * |
| 499 | */ |
| 500 | int CPLIsUTF8(const char *pabyData, int nLen) |
| 501 | { |
| 502 | if (nLen < 0) |
| 503 | nLen = static_cast<int>(strlen(pabyData)); |
| 504 | return utf8test(pabyData, static_cast<unsigned>(nLen)) != 0; |
| 505 | } |
| 506 | |
| 507 | /************************************************************************/ |
| 508 | /* ==================================================================== */ |