[GH-ISSUE #1781] Change default charset UTF-8 #1499

Open
opened 2026-02-28 01:30:19 +03:00 by kerem · 4 comments
Owner

Originally created by @mylms on GitHub (Nov 19, 2024).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1781

Is it possible change default charset from UTF-8 to ISO-8859-2? I use this encodig in VS Code (because encoding chars for external display).
I would like to get some texts from WiFi portal to ESP32 and there is some problems with decoding letters á, č, ď, é, ě, í, ň, ó, ř, š, ť, ú, ů, ý, ž, Á, Č, Ď, É, Ě, Í, Ň, Ó, Ř, Š, Ť, Ú, Ů, Ý, Ž

ThankYou

Originally created by @mylms on GitHub (Nov 19, 2024). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1781 Is it possible change default charset from UTF-8 to ISO-8859-2? I use this encodig in VS Code (because encoding chars for external display). I would like to get some texts from WiFi portal to ESP32 and there is some problems with decoding letters á, č, ď, é, ě, í, ň, ó, ř, š, ť, ú, ů, ý, ž, Á, Č, Ď, É, Ě, Í, Ň, Ó, Ř, Š, Ť, Ú, Ů, Ý, Ž ThankYou
Author
Owner

@tablatronix commented on GitHub (Nov 20, 2024):

You mean the web browser? You can add a header

<!-- gh-comment-id:2487109785 --> @tablatronix commented on GitHub (Nov 20, 2024): You mean the web browser? You can add a header
Author
Owner

@mylms commented on GitHub (Nov 20, 2024):

Thank you for your advice. Yes, I mean in web browser. I try to add
wm.setCustomHeadElement("<meta charset='ISO-8859-2'>");

But anfortunatelly no change. Diacritic chars not working.

Screenshot_20241120-095557

<!-- gh-comment-id:2487946817 --> @mylms commented on GitHub (Nov 20, 2024): Thank you for your advice. Yes, I mean in web browser. I try to add `wm.setCustomHeadElement("<meta charset='ISO-8859-2'>");` But anfortunatelly no change. Diacritic chars not working. ![Screenshot_20241120-095557](https://github.com/user-attachments/assets/31809e8d-e08b-409f-bbdc-6a490a7d9e32)
Author
Owner

@mylms commented on GitHub (Nov 20, 2024):

Here is code of webpage. I can't paste it directly.
wifimngr_code

If I change charset directly in "wm_consts_en.h" everything works properly.

<!-- gh-comment-id:2487953037 --> @mylms commented on GitHub (Nov 20, 2024): Here is code of webpage. I can't paste it directly. ![wifimngr_code](https://github.com/user-attachments/assets/c871f408-431a-45c8-971c-13bc6dce17e1) If I change charset directly in "wm_consts_en.h" everything works properly.
Author
Owner

@assanges commented on GitHub (Jan 22, 2025):

Thank you for your advice. Yes, I mean in web browser. I try to add wm.setCustomHeadElement("<meta charset='ISO-8859-2'>");

But anfortunatelly no change. Diacritic chars not working.

Screenshot_20241120-095557

Are you modifying the wm_strings_en.h file?

Not sure if this will work but it's worth a try since I don't have an ESP board beside me.

Try to modify Line 28 in the i18n file (i.e., wm_string_en.h:28 or any self-created i18n file),
the charset in the HTML file was a hardcoded string, adding a custom HTML Head element would not work as you think.

const char WM_LANGUAGE[] PROGMEM = "en-US"; // i18n lang code (you might want to change this to "cs-CZ")

const char HTTP_HEAD_START[]       PROGMEM = "<!DOCTYPE html>"
"<html lang='en'><head>"
"<meta name='format-detection' content='telephone=no'>"
"<meta charset='UTF-8'>" // MODIFY CHARSET HERE, i.e. 'ISO-8859-2'
"<meta  name='viewport' content='width=device-width,initial-scale=1,user-scalable=no'/>"
"<title>{v}</title>";

<!-- gh-comment-id:2606403139 --> @assanges commented on GitHub (Jan 22, 2025): > Thank you for your advice. Yes, I mean in web browser. I try to add `wm.setCustomHeadElement("<meta charset='ISO-8859-2'>");` > > But anfortunatelly no change. Diacritic chars not working. > > ![Screenshot_20241120-095557](https://github.com/user-attachments/assets/31809e8d-e08b-409f-bbdc-6a490a7d9e32) Are you modifying the [`wm_strings_en.h`](../blob/master/wm_strings_en.h) file? Not sure if this will work but it's worth a try since I don't have an ESP board beside me. Try to modify Line 28 in the i18n file (i.e., [`wm_string_en.h:28`](../blob/master/wm_strings_en.h#L28) or any self-created i18n file), the charset in the HTML file was a hardcoded string, adding a custom HTML Head element would not work as you think. ``` const char WM_LANGUAGE[] PROGMEM = "en-US"; // i18n lang code (you might want to change this to "cs-CZ") const char HTTP_HEAD_START[] PROGMEM = "<!DOCTYPE html>" "<html lang='en'><head>" "<meta name='format-detection' content='telephone=no'>" "<meta charset='UTF-8'>" // MODIFY CHARSET HERE, i.e. 'ISO-8859-2' "<meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=no'/>" "<title>{v}</title>"; ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1499
No description provided.