Edzelf / ESP32-Radio

Internet radio based on ESP32, VS1053 and a TFT screen.
GNU General Public License v3.0
964 stars 227 forks source link

Special character in streamtitle for example äöüàéè #395

Open BenSeventy9 opened 3 years ago

BenSeventy9 commented 3 years ago

arial16.zip

I am currently coding/designing a custom Nextion interface.

As i live in Switzerland and have French, Italian and German as official language sometimes streamtitle contains special characters. On a Nextion display it is easy to make a custom font with utf-8 and ISO 8859-1 custom range characters: !"#$%&'()*+,-./ 0123456789:;<=>? @ABCDEFGHIJKLMNO PQRSTUVWXYZ[]^_ `abcdefghijklmno pqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬®¯ °±²³´µ¶·¸¹º»¼½¾¿ ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß àáâãäåæçèéêëìíîï ðñòóôõö÷øùúûüýþÿ

I comented out for testing: if ( //( b > 0x7F ) || // Ignore unprintable characters No luck.

Is there an other way to do this? May be ad a #use_umlauts in NEXTION.h in the future?

BenSeventy9 commented 3 years ago

Looks like problem with char and unsigned char. I try to switch to String instead because scrseg_struct contains also String.

BenSeventy9 commented 3 years ago

Have done it for my custom Nextion interface. I only use Radio without SD or USB so I haven't changed anything in CH376.h or SDcard.h.

Maybe you consider for the next version my idea. But you have to make some major changes:

String ISO_8859_1_CHAR[] = {"¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", " ", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ" }; String get_ISO_8859_1_charakter ( uint8_t b) { if ( b >= 32 && b <= 126 ) return String ( (char)b ) ; else if ( b >= 161 && b <= 255) return ISO_8859_1_CHAR[b - 161] ; else return "" ; }

Hope that's usefull for you