waltervl wrote: ↑Wednesday 12 February 2025 23:53
Use %2B
Eg
Should show 'plus+plus'
Why does Domoticz's script encode a string type user variable that is saved as a string in the SQLite database? What is the point, if not to be able to enter certain characters in the GUI ?
bool CSQLHelper::UpdateUserVariable(const std::string& varname, const _eUsrVariableType eVartype, const std::string& varvalue, const bool eventtrigger, std::string& errorMessage)
{
if (!CheckUserVariable(eVartype, varvalue, errorMessage))
return false;
auto result = safe_query("SELECT ID FROM UserVariables WHERE (Name=='%q')", varname.c_str());
if (result.empty())
return false;
std::string sLastUpdate = TimeToString(nullptr, TF_DateTime);
std::string szVarValue = CURLEncode::URLDecode(varvalue);
safe_query(
"UPDATE UserVariables SET ValueType='%d', Value='%q', LastUpdate='%q' WHERE (Name=='%q')",
eVartype,
szVarValue.c_str(),
sLastUpdate.c_str(),
varname.c_str()
);
if (m_bEnableEventSystem)
{
uint64_t vId = std::stoull(result[0][0]);
if (eventtrigger)
m_mainworker.m_eventsystem.SetEventTrigger(vId, m_mainworker.m_eventsystem.REASON_USERVARIABLE, 0);
m_mainworker.m_eventsystem.UpdateUserVariable(vId, varname, (int)eVartype, szVarValue, sLastUpdate);
}
return true;
}