X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fi18n.c;h=c04dd5acaf9f6470e03b65e8544b8f7948f385cb;hb=d6c75296e5573a997c79a7af1195b6a619c0190c;hp=9658866056f01f7911c905e1d2d4896fb0288cbe;hpb=d12d1f1b4a8a43d611e1c30b57f5bd66178a103a;p=pspp diff --git a/src/libpspp/i18n.c b/src/libpspp/i18n.c index 9658866056..c04dd5acaf 100644 --- a/src/libpspp/i18n.c +++ b/src/libpspp/i18n.c @@ -769,3 +769,17 @@ is_encoding_supported (const char *encoding) return (create_iconv__ ("UTF-8", encoding)->conv != (iconv_t) -1 && create_iconv__ (encoding, "UTF-8")->conv != (iconv_t) -1); } + +/* Returns true if E is the name of a UTF-8 encoding. + + XXX Possibly we should test not E as a string but its properties via + iconv. */ +bool +is_encoding_utf8 (const char *e) +{ + return ((e[0] == 'u' || e[0] == 'U') + && (e[1] == 't' || e[1] == 'T') + && (e[2] == 'f' || e[2] == 'F') + && ((e[3] == '8' && e[4] == '\0') + || (e[3] == '-' && e[4] == '8' && e[5] == '\0'))); +}