• Login
Community
  • Login

Convert text from ASCII to OEM

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 6.3k Views
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.
  • C
    Conrad Cramer
    last edited by Jan 6, 2017, 12:39 PM

    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
    • P
      PeterJones
      last edited by Jan 6, 2017, 2:25 PM

      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
      • G
        guy038
        last edited by guy038 Jan 6, 2017, 7:56 PM Jan 6, 2017, 7:56 PM

        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
        • C
          Conrad Cramer
          last edited by Jan 12, 2017, 11:44 AM

          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
          1 out of 4
          • First post
            1/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors