From: Maxim Mamontov Date: Fri, 4 Feb 2011 13:42:25 +0000 (+0200) Subject: Виправлено роботу з перекодуванням рядків X-Git-Tag: 2.407-rc3~183 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/dce2fb0b94691ade4653096256eee1d76cfa1728?hp=--cc Виправлено роботу з перекодуванням рядків Тепер коректно обробляються українські і білоруські символи у полях користувача. Актуально для корнсольного конфігуратора і XML RPC API. --- dce2fb0b94691ade4653096256eee1d76cfa1728 diff --git a/projects/sgconf/common_sg.cpp b/projects/sgconf/common_sg.cpp index 77d7476f..09fcfd77 100644 --- a/projects/sgconf/common_sg.cpp +++ b/projects/sgconf/common_sg.cpp @@ -218,12 +218,12 @@ char charsetT[100]; if (encType == TO_KOI8) { strcpy(charsetF, nl_langinfo(CODESET)); - strcpy(charsetT, "koi8-r"); + strcpy(charsetT, "koi8-ru"); } else { strcpy(charsetT, nl_langinfo(CODESET)); - strcpy(charsetF, "koi8-r"); + strcpy(charsetF, "koi8-ru"); } size_t nconv = 1; diff --git a/projects/sgconf/main.cpp b/projects/sgconf/main.cpp index 0a2e12b4..ce8af73f 100644 --- a/projects/sgconf/main.cpp +++ b/projects/sgconf/main.cpp @@ -948,7 +948,7 @@ while (1) break; case 'A': //nAme - ParseAnyString(optarg, &str, "koi8-r"); + ParseAnyString(optarg, &str, "koi8-ru"); req.name = str; break; diff --git a/projects/sgconf/sginfo.cpp b/projects/sgconf/sginfo.cpp index 1c9048e7..aa247dfb 100644 --- a/projects/sgconf/sginfo.cpp +++ b/projects/sgconf/sginfo.cpp @@ -329,7 +329,7 @@ setlocale(LC_ALL, ""); char charsetF[255]; strncpy(charsetF, nl_langinfo(CODESET), 255); -char * charsetT = "koi8-r"; +char * charsetT = "koi8-ru"; size_t nconv = 1; diff --git a/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp b/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp index 8e03c63a..07cd312f 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp @@ -45,32 +45,32 @@ else structVal["tariff"] = xmlrpc_c::value_string(iter->property.tariffName.Get()); } -structVal["note"] = xmlrpc_c::value_string(IconvString(iter->property.note, "KOI8-R", "UTF-8")); +structVal["note"] = xmlrpc_c::value_string(IconvString(iter->property.note, "KOI8-RU", "UTF-8")); -structVal["phone"] = xmlrpc_c::value_string(IconvString(iter->property.phone, "KOI8-R", "UTF-8")); +structVal["phone"] = xmlrpc_c::value_string(IconvString(iter->property.phone, "KOI8-RU", "UTF-8")); -structVal["address"] = xmlrpc_c::value_string(IconvString(iter->property.address, "KOI8-R", "UTF-8")); +structVal["address"] = xmlrpc_c::value_string(IconvString(iter->property.address, "KOI8-RU", "UTF-8")); -structVal["email"] = xmlrpc_c::value_string(IconvString(iter->property.email, "KOI8-R", "UTF-8")); +structVal["email"] = xmlrpc_c::value_string(IconvString(iter->property.email, "KOI8-RU", "UTF-8")); std::vector userdata; -userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata0.Get(), "KOI8-R", "UTF-8"))); -userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata1.Get(), "KOI8-R", "UTF-8"))); -userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata2.Get(), "KOI8-R", "UTF-8"))); -userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata3.Get(), "KOI8-R", "UTF-8"))); -userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata4.Get(), "KOI8-R", "UTF-8"))); -userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata5.Get(), "KOI8-R", "UTF-8"))); -userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata6.Get(), "KOI8-R", "UTF-8"))); -userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata7.Get(), "KOI8-R", "UTF-8"))); -userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata8.Get(), "KOI8-R", "UTF-8"))); -userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata9.Get(), "KOI8-R", "UTF-8"))); +userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata0.Get(), "KOI8-RU", "UTF-8"))); +userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata1.Get(), "KOI8-RU", "UTF-8"))); +userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata2.Get(), "KOI8-RU", "UTF-8"))); +userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata3.Get(), "KOI8-RU", "UTF-8"))); +userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata4.Get(), "KOI8-RU", "UTF-8"))); +userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata5.Get(), "KOI8-RU", "UTF-8"))); +userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata6.Get(), "KOI8-RU", "UTF-8"))); +userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata7.Get(), "KOI8-RU", "UTF-8"))); +userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata8.Get(), "KOI8-RU", "UTF-8"))); +userdata.push_back(xmlrpc_c::value_string(IconvString(iter->property.userdata9.Get(), "KOI8-RU", "UTF-8"))); structVal["userdata"] = xmlrpc_c::value_array(userdata); -structVal["name"] = xmlrpc_c::value_string(IconvString(iter->property.realName, "KOI8-R", "UTF-8")); +structVal["name"] = xmlrpc_c::value_string(IconvString(iter->property.realName, "KOI8-RU", "UTF-8")); -structVal["group"] = xmlrpc_c::value_string(IconvString(iter->property.group, "KOI8-R", "UTF-8")); +structVal["group"] = xmlrpc_c::value_string(IconvString(iter->property.group, "KOI8-RU", "UTF-8")); structVal["status"] = xmlrpc_c::value_boolean(iter->GetConnected()); structVal["aonline"] = xmlrpc_c::value_boolean(iter->property.alwaysOnline.Get()); @@ -162,7 +162,7 @@ if ((it = structVal.find("ips")) != structVal.end()) if ((it = structVal.find("address")) != structVal.end()) { - std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-R")); + std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-RU")); if (iter->property.address.Get() != value) if (!iter->property.address.Set(value, admin, @@ -173,7 +173,7 @@ if ((it = structVal.find("address")) != structVal.end()) if ((it = structVal.find("phone")) != structVal.end()) { - std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-R")); + std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-RU")); if (iter->property.phone.Get() != value) if (!iter->property.phone.Set(value, admin, @@ -184,7 +184,7 @@ if ((it = structVal.find("phone")) != structVal.end()) if ((it = structVal.find("email")) != structVal.end()) { - std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-R")); + std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-RU")); if (iter->property.email.Get() != value) if (!iter->property.email.Set(value, admin, @@ -283,7 +283,7 @@ if ((it = structVal.find("disableddetailstat")) != structVal.end()) if ((it = structVal.find("name")) != structVal.end()) { - std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-R")); + std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-RU")); if (iter->property.realName.Get() != value) if (!iter->property.realName.Set(value, admin, @@ -294,7 +294,7 @@ if ((it = structVal.find("name")) != structVal.end()) if ((it = structVal.find("group")) != structVal.end()) { - std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-R")); + std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-RU")); if (iter->property.group.Get() != value) if (!iter->property.group.Set(value, admin, @@ -305,7 +305,7 @@ if ((it = structVal.find("group")) != structVal.end()) if ((it = structVal.find("note")) != structVal.end()) { - std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-R")); + std::string value(IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "KOI8-RU")); if (iter->property.note.Get() != value) if (!iter->property.note.Set(value, admin, @@ -334,7 +334,7 @@ if ((it = structVal.find("userdata")) != structVal.end()) for (unsigned i = 0; i < userdata.size(); ++i) { - std::string value(IconvString(xmlrpc_c::value_string(udata[i]), "UTF-8", "KOI8-R")); + std::string value(IconvString(xmlrpc_c::value_string(udata[i]), "UTF-8", "KOI8-RU")); if (userdata[i]->Get() != value) if (!userdata[i]->Set(value, admin,