mirror of
https://github.com/znc/znc.git
synced 2026-05-02 11:32:29 +02:00
Webadmin: Add GUI for character encoding
This commit is contained in:
@@ -22,6 +22,11 @@
|
||||
#endif /* HAVE_LIBSSL */
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_ICU
|
||||
#include <unicode/ucnv.h>
|
||||
#include <unicode/errorcode.h>
|
||||
#endif
|
||||
|
||||
// Required with GCC 4.3+ if openssl is disabled
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
@@ -477,6 +482,27 @@ SCString CUtils::GetTimezones() {
|
||||
return result;
|
||||
}
|
||||
|
||||
SCString CUtils::GetEncodings() {
|
||||
static SCString ssResult;
|
||||
#ifdef HAVE_ICU
|
||||
if (ssResult.empty()) {
|
||||
for (int i = 0; i < ucnv_countAvailable(); ++i) {
|
||||
const char* pConvName = ucnv_getAvailableName(i);
|
||||
ssResult.insert(pConvName);
|
||||
icu::ErrorCode e;
|
||||
for (int st = 0; st < ucnv_countStandards(); ++st) {
|
||||
const char* pStdName = ucnv_getStandard(st, e);
|
||||
icu::LocalUEnumerationPointer ue(ucnv_openStandardNames(pConvName, pStdName, e));
|
||||
while (const char* pStdConvNameEnum = uenum_next(ue.getAlias(), NULL, e)) {
|
||||
ssResult.insert(pStdConvNameEnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return ssResult;
|
||||
}
|
||||
|
||||
MCString CUtils::GetMessageTags(const CString& sLine) {
|
||||
if (sLine.StartsWith("@")) {
|
||||
VCString vsTags;
|
||||
|
||||
Reference in New Issue
Block a user