Stray 357, 273 and 277

Hi everyone,

I get these errors:

C:\Users\bb\Documents\Arduino\ESP8266_relay_webpage\ESP8266_relay_webpage.ino:1:1: error: stray '\357' in program
 #include<ESP8266mDNS.h>
 ^
C:\Users\bb\Documents\Arduino\ESP8266_relay_webpage\ESP8266_relay_webpage.ino:1:1: error: stray '\273' in program
C:\Users\bb\Documents\Arduino\ESP8266_relay_webpage\ESP8266_relay_webpage.ino:1:1: error: stray '\277' in program
C:\Users\bb\Documents\Arduino\ESP8266_relay_webpage\ESP8266_relay_webpage.ino:1:4: error: stray '#' in program
 #include<ESP8266mDNS.h>
    ^
C:\Users\bb\Documents\Arduino\ESP8266_relay_webpage\ESP8266_relay_webpage.ino:1:5: error: 'include' does not name a type
 #include<ESP8266mDNS.h>
     ^
C:\Users\bb\Documents\Arduino\ESP8266_relay_webpage\ESP8266_relay_webpage.ino: In function 'void setup()':
C:\Users\bb\Documents\Arduino\ESP8266_relay_webpage\ESP8266_relay_webpage.ino:39:7: error: 'mDNS' was not declared in this scope
   if (mDNS.begin(dns_name)) {
       ^

exit status 1

Compilation error: stray '\357' in program

altho I checked that I have no special charachters somewhere around. Can you help me troubleshoot this problem?

This is my code. I hope you can read this fine?

#include<ESP8266mDNS.h>
#include<ESP8266WebServer.h>
#include<ESP8266WiFi.h>

//#include <ESP8266WiFi.h>
//#include <ESP8266WebServer.h>
//#include <ESP8266mDNS.h>

ESP8266WebServer server (80);

const char* SSID = "iPhone-FOC";
const char* password= "12345678";

// following for the name of: http://name_esp.local/
const char* dns_name = "esp8266";

int d1 = 2;
int d1_status = 0;

void setup() 
{
 Serial.begin(115200);
  Serial.println("ESP gestartet");
  pinMode(d1, OUTPUT);

  WiFi.begin(SSID, password);

  Serial.print("Verbindung wird hergestellt ...");
  while (WiFi.status () != WL_CONNECTED)
  {
      delay(500);
      Serial.print(".");
  }
  Serial.println();

  Serial.print("Verbunden! IP-Adresse: ");
  Serial.println(WiFi.localIP());

  if (mDNS.begin(dns_name)) {
    Serial.println("DNS gestartet, erreichbar unter: ");
    Serial.println("http://" + String(dns_name) +  ".local/");
    }

server.onNotFound([] (){
    server.send(404, "text/plain", "Link wurde nicht gefunden");
});

server.on("/", [] () {
    server.send(200, "text/plain", "ESP-Startseite!");
});

server.on("/relais_on", [] () {
  server.send(200, "text/plain", "Relais an");
  relais_on();
});

server.on("/relais_off", [] () {
  server.send(200, "text/plain", "Relais aus");
  relais_off();
});

server.begin();
Serial.println("Webserver gestartet.");
}

void loop() {
  server.handleClient();
}

void relais_on() {
    digitalWrite(d1, HIGH);
}

void relais_off(){
  digitalWrite(d1, LOW);
}

You do have special characters in your code, it starts with a UTF-8 BOM, see Compiler error about stray characters - #3 by PieterP.

Oh so the problem is my ‘‘‘#‘‘‘

So I’ll need to save it as UTF-8?

I’ll try that soon.

Thanks in advance :slight_smile:

BR Tim

The # itself is fine, the BOM is before that, it's invisible.

Got it thanks! I’ll try this weekend!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.