How to Convert Damaged Cyrillic to Normal

I have files on the server. Initially their names are readable and users put their files (names contain Cyrillic characters) on the server and I get their files from my application. The problem is that when I get these files from the server, their names are different from their original names. Something like this "Good ...", but the original names do not contain such characters (only abvgdeozhziyklmnoprstufkhtschshshch'eyuya). I don't know how they upload the files (they have FTP access), but of course they know that their names are "good" before uploading and "corrupted" after, on the server. Even filezilla shows their names are corrupted.

I need help recovering damaged names. I am using Java

+3


source to share


1 answer


Try the following:

    String s = "Ìóõòîð";
    final byte[] cp1252s = s.getBytes("Cp1252");
    final String s1 = new String(cp1252s, "Cp1251");
    System.out.println(s1);

      



Prints: Muhtor

+4


source







All Articles