ANSI not saving Polish and Russian characters

  • I’m translating certain files that need to be in ANSI(compiler won’t accept anything else). But upon saving in ANSI these characters are lost. What can I do about it?

  • It depends on what your “compiler” means by “ANSI character set”.

    • If it means Windows-1252, looking at the charcter set in that encoding, there are no Polish or Russian characters. This is the encoding that will be used if you Encoding > Convert To ANSI in Notepad++.
    • If it means “one of the many 8-bit Windows code pages”, some of them have Polish or Russian characters, some don’t; none of them are compatible with each other, and you have to have some way of telling the compiler which code patge is being used.

    My guess is that whatever language you are using that requires an 8-bit character set (“ANSI” of either flavor) has a mechanism for escaping unicode characters inside its strings, rather than typing the character directly. For example, in C, if you cannot type "Ж", you can use "\u0416" to get that unicode character. If your language/compiler is code-page aware, there may be a way to set it, and use something like "\x##" inside your string, with whatever code point is that character in that specific code page.

    But none of these are directly Notepad++ related (ie, it’s a problem that is the same, no matter what text editor you use for editing your source code). Basically, if your compiler requires only 8-bit characters (and won’t accept an encoding like UTF-8 which uses multiple bytes to encode one character for code points above 127), then you need to learn in your language/compiler how to encode/escape characters that aren’t in its native character set, and that’s not something we can help you with.

    Once you have the details of how to escape those characters in your string, together with a list of the likely characters that you’d need to convert, we might be able to help you with a sequence of Notepad++ search-and-replace and file-encoding-changes that will be able to convert the file to the right encoding and the fancy characters to the right string-escapes. It all depends on how many different characters you need, how many files you have, and the syntax of the escapes in your language.

Log in to reply