Convert text from ASCII to OEM
So far I’m using a very old version of editpad to convert text from ASCII to OEM and v.v.
Now I need to convert from UTF-8 to OEM. The new version of editpad is capable of converting about any coding to any other. But it is pretty expensive …
On first sight I’ve thought that notepad++ has the same capabilities, but taking a closer look it seems, that note-pad++ can only VIEW textfiles in different encodings.
Conversion is only possible within a very small range of encodings – no OEM-Version…
Did I miss something? Any addon, that would be helpful.
I don’t see the
Convert To...for any OEM, but the
Character Sets ▶sub-menus have plenty of different OEM character sets … When I put some Unicode characters in a UTF-8 document and then change to one of those sets, I can definitely see that NPP re-interprets what’s there. But I doubt that’s what you want.
My guess is that what you want could be done using the PythonScript plugin. I did a quick search for “python convert UTF-8 to OEM”, and found this StackOverflow question, which shows some examples of using
text.decode('cp437').encode('utf8')… which could probably be extrapolated to
newText = text.decode('utf8').encode('cp###'), where
###is the OEM-Version, and the variable
textcame from the document (see PythonScript documentation for how to grab the contents of the file); then you would write newText back into the document.
Sorry for the lack of details; I am not a python programmer, so cannot just write it off the cuff (though there are some in this forum who probably could). If it were my problem to solve, I would follow the hints from that SO question, and read in the PythonScript documentation for how to get the document text into a python variable, and v.v. One of the Python / PythonScript experts on the forum could probably fill in the details without too much difficulty (or possibly tell us that there’s a much simpler way to do it).
Whatever the method that you’ll, finally, use to convert any UTF-8 encoded text to a specific OEM encoded text, just be sure that ALL the characters, in your original UTF-8 file, belongs to the 256 characters set of that specific OEM code-page !
Indeed, any OEM encoded character can be correctly written, after conversion to the UTF-8 encoding. But the opposite is NOT TRUE :-((
Thank you Peter!
… see that NPP re-interprets what’s there. But I doubt that’s what you want.
What you’ve said about the PythonScript sounds good, but , sorry, too complicated for me. I’m not an IT-Expert, just a slightly advanced user… If there is no readymade plug-in/add-on available it’s probably much easier to pay the money for Edit Pad Pro.
Thank you too, but I’m aware of that