Community
    • Login

    Convert text from ASCII to OEM

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 6.9k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Conrad CramerC Offline
      Conrad Cramer
      last edited by

      Hello!

      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.

      Thank you
      Conrad

      1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones
        last edited by

        I don’t see the Encoding > Convert To... for any OEM, but the Encoding > 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 text came 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).

        1 Reply Last reply Reply Quote 0
        • guy038G Offline
          guy038
          last edited by guy038

          Hello Conrad,

          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 :-((

          Best Regards

          guy038

          1 Reply Last reply Reply Quote 1
          • Conrad CramerC Offline
            Conrad Cramer
            last edited by

            Thank you Peter!

            … see that NPP re-interprets what’s there. But I doubt that’s what you want.

            Exactly ;-)

            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.

            @guy038

            Thank you too, but I’m aware of that

            Kind regards,
            Conrad

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors