Not to resurrect a dead post, but this was the first helpful result in a quick search so I'd imagine others would kand here as well.
For me the issues was the keyboard mapping. I didn't realize it was off until I went to manually edit a /etc/network/interfaces.d/99-wifi file to add the lines referenced above. Vi was acting weird because of the mapping being off.
tl;dr make sure all of the localisation settings are configured prior to doing the wifi setup.