Bug report for format convert!



  • When I convert a text file from UTF-8 to ANSI (Encoding > Convert to ANSI), the save and reopen the file, but it still show the format is UTF-8!



  • Hello, @张锋, and All,

    Probably, your text contains NO character with Unicode value over \x{007F} ;-))

    Remember that, when the Unicode value of a character is :

    • Under \x{0080}, the N++ ANSI and UTF-8 encodings are strictly equivalent and use 1 byte to encode the character

    • Over \x{007F}, the UTF-8 and UTF-8 BOM encodings use from 2 to 4 bytes, whereas the ANSI encoding still use a 1 byte to encode that character !

    So, if your text contains only pure ASCII characters ( under \x{0080} ), there no way, for Notepad++, on opening that file, to determine the right encoding, and it chooses, by default, the UTF-8 encoding, ( which does not contain the invisible BOM : Byte Order Mark )

    So, to be sure that the ANSI encoding will be kept, just change this default behavior :

    • Choose the Settings > Preferences > New document option

    • In the Encoding section, just uncheck the squared box Apply to opened ANSI files

    • Close the Preferences dialog , by clicking on the Close button

    • Preferably, stop and re-start Notepad++

    Best Regards,

    guy038


Log in to reply