You could try another method which could be interesting for you .I have just seen that searching more explanation on the gdb utilisation : getfilesystemencoding(), always instead of getdefaultlocale.
You could try another method which could be interesting for you .I have just seen that searching more explanation on the gdb utilisation : getfilesystemen coding( ), always instead of getdefaultlocale.