Added 'deg' symbol to custom messages sent via HA

This commit is contained in:
M-Factory
2025-11-22 20:13:26 +09:00
parent 8cf03b3788
commit 4ffd8f4697
2 changed files with 10 additions and 0 deletions

View File

@@ -1270,6 +1270,11 @@ void setupWebServer() {
if ((c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == ' ' || c == ':' || c == '!' || c == '\'' || c == '-' || c == '.' || c == ',' || c == '_' || c == '+' || c == '%' || c == '/' || c == '?') {
filtered += c;
}
// Check for degree symbol (UTF-8 0xC2 0xB0)
else if ((unsigned char)c == 0xC2 && i + 1 < msg.length() && (unsigned char)msg[i + 1] == 0xB0) {
filtered += "°"; // add single character
i++; // skip next byte
}
}
filtered.toCharArray(customMessage, sizeof(customMessage));

View File

@@ -1268,6 +1268,11 @@ void setupWebServer() {
if ((c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == ' ' || c == ':' || c == '!' || c == '\'' || c == '-' || c == '.' || c == ',' || c == '_' || c == '+' || c == '%' || c == '/' || c == '?') {
filtered += c;
}
// Check for degree symbol (UTF-8 0xC2 0xB0)
else if ((unsigned char)c == 0xC2 && i + 1 < msg.length() && (unsigned char)msg[i + 1] == 0xB0) {
filtered += "°"; // add single character
i++; // skip next byte
}
}
filtered.toCharArray(customMessage, sizeof(customMessage));