Spanish character display (á, é, í, ó, ú, ü, ñ)

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Spanish character display (á, é, í, ó, ú, ü, ñ)

      Hi,

      I tried to display Spanish characters with GUI_Font24B_1 but á is not displayed correctly. How can I display these á, é, í, ó, ú, ü, ñ ¡ ¿ characters?

      Here is my code and I checked the font has the characters from the manual.

      hItem = TEXT_CreateEx(550, 153, 200, 28, pMsg->hWin, WM_CF_SHOW | WM_CF_MEMDEV, 0, ID_TEXT_3, NULL);
      TEXT_SetFont(hItem, &GUI_Font24B_1);
      TEXT_SetText(hItem, "ABC á¡¿");

      And I can't seem to display text like this with TEXT_SetText(hItem, "Temp: 10\xb0C");

      Temp: 10°C

      Because C can not be combined with \xb0. Does anyone know how to connect code '\xb0' and character 'C'?

      Thanks.

      The post was edited 2 times, last by CKim ().

    • Hi,

      The Spanish characters are within the ISO 8859-1 Western Latin character set, which are the characters 0xA0 up until 0xFF. Since the ANSI-C standard doesn't allow characters above 0x7F in the source code, you should rather use hex values for these characters.

      You can find a full table of the ISO 8859-1 Western Latin character set in the manual. To display these characters with emWin, add the hexademical value of the character to a string, like so:

      C Source Code

      1. TEXT_SetText(hItem, "ABC \xe1\xa1\xbf");

      For the string "10°C", try to also notate the C as a hex value: TEXT_SetText(hItem, "Temp: 10\xb0\x43");

      Best regards,
      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.