Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default charset UTF-8 #1781

Open
mylms opened this issue Nov 19, 2024 · 4 comments
Open

Change default charset UTF-8 #1781

mylms opened this issue Nov 19, 2024 · 4 comments

Comments

@mylms
Copy link

mylms commented Nov 19, 2024

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

@tablatronix
Copy link
Collaborator

You mean the web browser? You can add a header

@mylms
Copy link
Author

mylms commented 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

@mylms
Copy link
Author

mylms commented 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.

@assanges
Copy link

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>";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants