Fix the problem with encoding

Tested on Gentoo linux, Windows XP and Server 2008 r2
Bug:
![img4](https://f.cloud.github.com/assets/1074478/248210/bf3a61fa-8b03-11e2-8f69-86d2aef04330.png)
After chagnes:
![winserv](https://f.cloud.github.com/assets/1074478/248307/67466440-8b07-11e2-9bf3-0e6e71656105.png)