itblumi, you code works fine on Linux. That says to me that your issue somehow relates to how Windows handles utf-8 in Lazarus. I am not a Windows user so cannot say what that is, but I don't take extra precautions to make such code work on Windows so I suggest you have a deliberately selected a different code page perhaps ?
Must be a Windows user who can help ...
Davo