jevniky:
I cant hard code it. That the point
With hard coded ssid/pass it work of course.
With newline setting in SM it works, Ill implement @J-M-L ideas to make it more "general".Now I have problem with the C# application sending these data. But that's for another topic.
Thx guys.
The suggestion of hard coding the credentials was intended only to isolate the problem, and if you had already got that far, it would have been ideal if you had mentioned it in the OP.
Incidentally, the normal way of getting WLAN credentials into an ESP8266 is through a web browser, with the ESP8266 temporarily in "Access Point" mode and running a web server. Something like this makes it quite painless ESP8266 WiFi configuration manager library for Arduino IDE