The only thing I can suggest is using a setlocale for Turkish is the wrong way, as Unicode was supposed to get away from that.
tolower really is only for ASCII. But the toUniLower should work right with Turkish, though I don't know what right is for that case.