• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Swedish character

Q&A Forum › Category: ESP8266 › Swedish character
0 Vote Up Vote Down
Anders Carlsson asked 4 years ago

Hello!
i am reading the chapter Build an ESP8266 Web Server and it works! But I don`t get the html page to show the Swedish letters å,ä,ö correct. I have tested with : client.println(“<head><meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />”); and also: client.println(“<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />”); So any help would be grateful!  Anders
// Display the HTML web page
client.println(“<!DOCTYPE html><html>”);
client.println(“<head><meta name=\”viewport\” content=\”width=device-width, initial-scale=1\”>”);
client.println(“<head><meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />”);
client.println(“<link rel=\”icon\” href=\”data:,\”>”);

Question Tags: Swedish character
11 Answers
0 Vote Up Vote Down
Anders Carlsson answered 4 years ago

Hello! I have also tryed with : client.println(“<head><meta http-equiv=“Content-Type: text/plain; charset=ISO-8859-1” />”); And it didn`t work eighter

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
I think you should use the HTML entities instead of the characters.
Here are the HTML entities for the Swedish characters: https://usefulwebtool.com/characters-swedish
Try it and tell me if it works.
Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 4 years ago

Hello Sara! And thank`s for your fast reply! Yes I have used it to get it to work. But i wanted it to work  just by typing the Swedish characters. I will use this soulution now and meanwhile I try to find a solution how to solve this.
Regards,
Anders

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Anders.
You can also try taking a look at some of the suggestions in this discussion: https://stackoverflow.com/questions/1365526/swedish-characters-and-utf-8.
Some of them, you already tried them. But, this can have something that might help.
Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 4 years ago

Hi Sara!
I have been testing this and load another example DS18B20 Async Web Server. And if you there use this <!DOCTYPE html>
<html lang=”sv”>
<head>
<meta charset=”utf-8″/>
Then you are able to use å,ä,ö as characters.
So something with the client.println seems to make it not to work.Both of them is stated as html5 so you should get both of them to work. I will continue to find a solution for this.
 

0 Vote Up Vote Down
Anders Carlsson answered 4 years ago

Helllo Sara! It is someting wrong with my quotas. If I look at view-source I get this:
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<meta name=”viewport” content=”width=device-width, initial-scale=1″> 

So I copied the quotas from the second lline and past it in. But then it dosen`t when I try to compile it I get a fault expected ‘)’ before ‘Content’
Regards Anders

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
Can you show me the lines of code where you get the error?
That error means that you have a ) missing somewhere in your code.
Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 4 years ago

// Display the HTML web page
client.println(“<!DOCTYPE html><html>”);
client.println(“<head><meta name=\”viewport\” content=\”width=device-width, initial-scale=1\”>”);
client.println(“<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /”>”);
client.println(“<link rel=\”icon\” href=\”data:,\”>”);
// CSS to style the on/off buttons
// Feel free to change the background-color and font-size attributes to fit your preferences
client.println(“<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}”);
client.println(“.button { background-color: #195B6A; border: none; color: white; padding: 16px 40px;”);
client.println(“text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}”);
client.println(“.button2 {background-color: #1fd787;}</style></head>”);

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

You are escaping (using a back slash) double quote characters to use inside a double quoted string. Whilst this is workable it leads to difficult to read (And troubleshoot) strings. In your case on the third line you are missing the escape characters for the double quotes.
 
A better way to do this is to get rid of the escapes altogether (Only use escapes when absolutely necessary). Use single quotes inside a double quoted string (or use double quotes inside a single quoted string). For example, your second line could be:
client.println(“<head><meta name=’viewport’ content=’width=device-width, initial-scale=1′>”);
or
client.println(‘<head><meta name=”viewport” content=”width=device-width, initial-scale=1”>’);
 
So, either add the required escapes to your third line or remove them altogether using the above.

0 Vote Up Vote Down
Anders Carlsson answered 4 years ago

Hello Steve!
Thank you for your explonation, now I have got this to work! It looks like this :
// Display the HTML web page
client.println(“<!DOCTYPE html><html>”);
client.println(“<head><meta name=’viewport’ content=’width=device-width, initial-scale=1′>”);
client.println(“<meta http-equiv=’Content-Type’ content=text/html; charset=utf-8 /’>”);
client.println(“<link rel=\”icon\” href=\”data:,\”>”);
So the case resolved

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Great!
I’ll mark this issue as resolved.
If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.