2025-01-03 09:23 AM - edited 2025-01-03 09:39 AM
Hello to all ,
I am wanting to display a text that changes over time what it says, this works fine but for some reason the letters with tilde or the Ñ does not appear.
I put a picture of how I set the typography and how it is shown badly written in the simulation.
in “wildcard characters” I added áéíóúÁÉÍÓÚñÑ and in “wildcard ragne” I put ,Á-Ú,á-ú,ñ-Ñ but it did not work.
why does this problem occur?
Error 1: Blower dañado
Error 6: Alimentación insuficiente (it was cut off by the scrollablecontainer, it doesn't matter)
Error 12: Unidad no respondía
Solved! Go to Solution.
2025-01-03 01:37 PM
Hi @Maximiliano
Prefix the string with 'u'
Unicode::snprintf(texto_errorBuffer, TEXTO_ERROR_SIZE, "%s", u"Ñá");
texto_error.invalidate()
I attached example project.
2025-01-03 10:30 AM - edited 2025-01-03 10:42 AM
Maybe this helps you Solved: "Tildes" don't appear in wildcard texts. - STMicroelectronics Community
understand Unicode UTF mix. And good practice is show version in your question...
Plus i test your in static and wildcard from designer , then it works ok . What is your code where fail???
2025-01-03 11:38 AM
Hello @MM..1 thank you for replying.
the fault is in the buffered text.
I also tried putting directly a ñ or a letter with tilde and it fails too.
I don't know if I understood correctly, but is your capture of a text without buffer?
Unicode::snprintf(texto_errorBuffer, TEXTO_ERROR_SIZE, "%s", "Ñá");
texto_error.invalidate();
Un ejemplo del uso que le estoy dando es:
const char* errors[] = {
"Error 1: Blower dañado",
"Error 2: Ventilador no gira",
"Error 3: Sobrecalentamiento detectado",
"Error 4: Cortocircuito en el sistema",
"Error 5: Falla en el sensor de temperatura",
"Error 6: Alimentación insuficiente",
"Error 7: Comunicación interrumpida",
"Error 8: Batería descargada",
"Error 9: Temperatura fuera de rango",
"Error 10: Fallo en la conexión de red",
"Error 11: Memoria insuficiente",
"Error 12: Unidad no respondía"
};
// Cambiar el tamaño del arreglo a uno adecuado para el mensaje de error
char errorBuffer[512];
// Buffer de tipo Unicode::UnicodeChar para la cadena final
Unicode::UnicodeChar finalErrorBuffer[512];
// Inicializar el buffer de errores como vacío
errorBuffer[0] = '\0';
int error_code1 = 1; // Error 1
int error_code2 = 6; // Error 6
int error_code3 = 12; // Error 12
// Copiar el primer error
strncpy(errorBuffer, errors[error_code1 - 1], sizeof(errorBuffer) - 1);
strncat(errorBuffer, "\n", sizeof(errorBuffer) - strlen(errorBuffer) - 1); // Añadir salto de línea
// Copiar el segundo error
strncat(errorBuffer, errors[error_code2 - 1], sizeof(errorBuffer) - strlen(errorBuffer) - 1);
strncat(errorBuffer, "\n", sizeof(errorBuffer) - strlen(errorBuffer) - 1);
// Copiar el tercer error
strncat(errorBuffer, errors[error_code3 - 1], sizeof(errorBuffer) - strlen(errorBuffer) - 1);
strncat(errorBuffer, "\n", sizeof(errorBuffer) - strlen(errorBuffer) - 1);
// Convertir el contenido de errorBuffer (char) a finalErrorBuffer (Unicode::UnicodeChar)
Unicode::strncpy(finalErrorBuffer, errorBuffer, sizeof(finalErrorBuffer) / sizeof(Unicode::UnicodeChar));
Unicode::snprintf(texto_errorBuffer, TEXTO_ERROR_SIZE, "%s", finalErrorBuffer);
texto_error.invalidate();
2025-01-03 12:28 PM
Strings in your source files is in UTF8 , then cant be used directly... why you dont read solution?
2025-01-03 01:37 PM
Hi @Maximiliano
Prefix the string with 'u'
Unicode::snprintf(texto_errorBuffer, TEXTO_ERROR_SIZE, "%s", u"Ñá");
texto_error.invalidate()
I attached example project.
2025-01-03 02:27 PM
Hello @ferro
Thank you very much! I am happy that this alone can work without having to make major modifications to the code.
Just to clarify for anyone else reading this:
with wildcard ranges:
a-z,A-Z,0-9,Á-Ú,á-ú,ñ-Ñ
it's ok, you don't need to put in wildcard characters.
2025-01-04 08:35 AM
" [it works] without major modifications to the code ..."
Music to my ears. Lovely. 2025 already feels like a success !!