I open Notepad (Windows) and write
Some lines with special characters Special: Žđšćč
and go to Save As...
Your code looks right - but a very common, and easy, error is to misstake what is printed to screen to what's in the String. Check with a debugger if the string isn't already read right.