
Here's the problem with those files: for some reason, when you load these files into Notepad++, it "hides" some of the stranger characters like the angled apostrophe, longer dashes or angled double quotes.

Therefore, I couldn't differentiate the two… until now.įor the files that Notepad++ couldn't detect, I noticed that the status bar was showing an encoding of ISO-8859-1. The problem, as you stated, is that when Notepad++ cannot detect the encoding (thus not selecting a menu item), notepad.getEncoding() returns COOKIE, which is the same result for files that are being detected as UTF-8 without a BOM. I ended up finding a solution using an encoding algorithm that I found called the "Universal Encoding Detector", which was also written in python: īasically, I am relying on Notepad++ to tell me which files are being detected as UTF-8 without a BOM as these were the ones causing issues for us in the first place. You might also be able to do this quite easily in Python, looking at the file itself - this stackoverflow question has a few good suggestions. And, their encoding detection is the best there is. That has support for every encoding under the sun, and can happily convert between them. If you know Java or C, you might also want to look at the intel ICU library. Once it's in N++, adding it to Python Script is a 10 minute job.Īlternative answer: N++ encoding detection is sketchy at best, you might want to look at more specialized tools to do encoding conversion/detection (Kaboom has been mentioned several times, although not used it myself). Patches sometimes sit there for ever, so I'll post a note on the Notepad-Plus Open Discussion forum, but then I'll leave it to you to "market it". I'll try and test it later, and if it works OK, I'll submit it.

Long(er) anser: That, to my view, is a bug in N++, however, messing with the encoding-code is not something I fancy getting into! However, getting the status bar text has been requested more than once, so I've made a patch that would enable that from N++.

Short answer : No - there's no API in Notepad++ to get the text on the status bar, and as you've discovered, it only reports ENC8BIT or COOKIE for ANSI or UTF8 w/o BOM files, and still reports COOKIE for ISO-8859-1. (I did see the post - Sourceforge's email notification system does work 99% of the time :)
