'After wiping out EEPROM with NULL, it later shows NBSP(255) instead of NULL(0)

So, I am a curious person. And been tinkling with NVS in ESP32 WROOM 32D for storage. What I did was simply write a formatting code to wipeout a few addresses in EEPROM with NULL, and after immediately doing that when I read that again, I got to see all 0s... as in NULL in all the addresses. But later on when I read it because I was simply working with other projects and rechecked the ESP32 storage to potentially store other data that I previously had erased... It would now read 255 in all spaces. Which a simple google search told me is ascii for nbsp(No breaking space).

I have to assume that are these two as in NULL and nbsp taken same? Or maybe it is just Arduino? I don't simply understand why this would happen. I am curious and have tried searching for answers and have come across the same kind of questions but in HTML and that too without any good explanations as to why this happens, other search results were bunch of ads. I am curious if the community knows something and can speculate or answer for sure why that happens. I have tested 2-3 ESPs so far and it has been the same.

Here's simple code that, well reads the values at these addresses:

#include <EEPROM.h>
#include <WiFi.h>
int byte_size = 512;
uint8_t value;
int Addr = 0;
String ssid;
String pass;

void setup() {
  Serial.begin(115200);
  //  Serial.begin(9600);
  EEPROM.begin(byte_size);

  while (!Serial.available()) {
    ;
  }
  EEPROM.commit();
  delay(4000);

  while (true) {
    value = EEPROM.read(Addr);
    Serial.print(Addr);
    Serial.print("\t");
    Serial.print(value);
    Serial.println();


    //    for (int i = 0 ; i < byte_size ; i++) {
    //      EEPROM.write(i, NULL);
    //    }

    Addr += 1; //Move address to the next byte
    delay(100);

    if (Addr == 512) {
      Addr = 0;
      break;
    }
  }
  for (int Addr = 0; Addr < byte_size; Addr++) {
    if (EEPROM.read(Addr) != NULL) {
      Serial.println(Addr);
      Serial.println("Something something");
    }
  }
  for (Addr = 0; Addr < 32; ++Addr) {
    ssid += String(char(EEPROM.read(Addr)));
  }
  Serial.println(ssid);
  for (Addr = 33; Addr < 96; ++Addr) {
    pass += String(char(EEPROM.read(Addr)));
  }
  Serial.println(pass);
  //  WiFi.begin(ssid.c_str(), pass.c_str());
  //  Serial.println("Trying to connect to WiFi now, thanks for that ssid and password.");
  //  while(WiFi.status()!=WL_CONNECTED){
  //    Serial.print(".\n");
  //    unsigned long count =millis();
  //    while(millis() - count < 1000){
  //      ;
  //    }
  //  }
  //  if(WiFi.status() == WL_CONNECTED){
  //    Serial.println("WiFi CONNECTED!");
  //  }
  EEPROM.end();
}

void loop() {
}

If my assumptions about NULL taken as nbsp are correct, it would be out of the question to read anything as NULL, from the EEPROM, right?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source