WiFiManager icon indicating copy to clipboard operation
WiFiManager copied to clipboard

fix profile line / csv for delimiter char existing in values

Open ThomasWaldmann opened this issue 6 years ago • 4 comments

currently ";" is used as csv delimiter. guess one will run into a problem if the ssid or password contains a ";".

ThomasWaldmann avatar Jan 19 '18 18:01 ThomasWaldmann

okey. whats is your suggestion to separate - tab, space or special character ?

tayfunulu avatar Jan 24 '18 17:01 tayfunulu

well, we don't know what people put in their ssids / passwords - could be anything (anything except 0x00 maybe due to C limitations)?

so an easy solution could be to use 0x00 as separator - slightly ugly because we have a text file containing zero bytes then.

another way would be to just encode/decode the ssid / password part, e.g. using base64 (unreadable for humans) or some repr-like encoding and use any char as delimiter that is not in the possible encoder output values.

or give up csv and just use pickle.dump?

ThomasWaldmann avatar Jan 25 '18 01:01 ThomasWaldmann

Hey there, just passing by this repository and found this issue and it came to my mind that instead of saving it into CSV format maybe it can be saved into JSON format and if any special character needs to be saved why not escaping them?

Also it came to my mind to encode the password string as Base64 which for example:

"hello world!" will be converted into ImhlbGxvIHdvcmxkISI=

One limitation I see on the last option will be memory space used but it might be a way to handle any password with special characters

yeyeto2788 avatar Feb 27 '18 13:02 yeyeto2788

JSON is not directly usable as it can not have arbitrary bytes in it, so we would need to encode all stuff that can be arbitrary bytes (password, ssid, ...).

But if we encode that much, what's left? We could also use pickle if it is not readable anyway.

ThomasWaldmann avatar Feb 27 '18 23:02 ThomasWaldmann