Wi-Fi configuration file - Spaces in SSID and PSK

What is the proper way of inputting SSID and PSK that have spaces?
Do I need double quotes? Single quotes? No quotes? Something else? Or is having spaces not allowed at all?

ssid=“My WiFi Name”
psk=“Pass word with spaces”

I know the Wi-Fi standard permits spaces in the SSID name but it is not recommended. Most people use a hyphen or underscore instead of a space.

I’ve changed the SSID to have underscores.
Still need to know how to handle password with spaces though.

Hi, how did you solve the issue? I am in the same situation an would like to know how to input an SSID with spaces.
Thanks in advance.

I ended up following this link: Guide: Connecting Pi with Home Assistant OS to wifi (or other networking changes)


nmcli device wifi connect "YOUR SSID" password "YOUR WIFI PASSWORD"

That seemed to work. Furthermore, after weeks of trying things, I realized that for whatever reason, this doesn’t work on 5GHz band. The moment I tried connecting to my 2.4GHz band, it worked first try.

Good luck!