Community
    • Login

    Open Notepad++ via command line with a certain character set

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    14 Posts 4 Posters 2.2k 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.
    • W
      whitecat
      last edited by

      Hi there,

      is there a possibility to start Notepad++ via command line with a file shown in a certain character set? For example I use Notepad++ to show the Robocopy logfile after finishing my backup to an external hard disk, but the file is displayed with the wrong encoding (I need “OEM 850” in order to see the German umlauts correctly).

      Currently using Notepad++ v7.8.5 on Windows 8.1 Pro 64 bit.

      Thank you.

      PeterJonesP 1 Reply Last reply Reply Quote 1
      • PeterJonesP
        PeterJones @whitecat
        last edited by

        @cyclingcat ,

        As far as I can tell, there are no documented command line arguments to select the encoding.

        However, Settings > Preferences > MISC (see docs) allows you to disable automatic encoding detection. That, possibly in conjunction with the New Document’s Encoding options , might be able to help.

        If that’s not sufficient, you can read our FAQ on feature requests. Personally, I think a command-line option to select an encoding is more useful than some of the command-line options. If you do submit a feature request, please paste the link in this thread, so others reading this topic can find out the status of the request.

        (Also, is it possible to set Robocopy to output UTF-8 or UCS-2 LE or some other modern Unicode encoding, rather than the antiquated 8bit OEM-850? In modern computing, using old encodings rather than full Unicode is just asking for trouble.)

        1 Reply Last reply Reply Quote 0
        • W
          whitecat
          last edited by

          I’m using the robocopy command line option /UNILOG to write the log file, but it seems to be broken - it doesn’t really write Unicode. Reconfiguring Notepad++ just for the sake of correctly displaying the robocopy logfile is not an option for me, because Notepad++ is my standard editor for nearly everything.

          There can never be too many command line options though, so I’d strongly vote for a possibility to indicate the character set/encoding when opening a file. I’ve just created Github issue #8082 for this.

          datatraveller1D 1 Reply Last reply Reply Quote 1
          • datatraveller1D
            datatraveller1 @whitecat
            last edited by

            @whitecat The AutoCodepage plugin might be useful for you.

            W 1 Reply Last reply Reply Quote 2
            • W
              whitecat @datatraveller1
              last edited by

              @datatraveller1,

              indeed, this solves my specific problem. Thank you for this hint. I had to modify my script though, now the logfile gets written into a file with a special extension (.log850) which I configured in the plugin.

              But the general problem remains - what to do with files from applications with given extensions? I would consider such a command line option as very useful.

              Alan KilbornA 1 Reply Last reply Reply Quote 0
              • Alan KilbornA
                Alan Kilborn @whitecat
                last edited by

                @whitecat said in Open Notepad++ via command line with a certain character set:

                But the general problem remains … I would consider such a command line option as very useful.

                How would you envision such a command line syntax?

                notepad++ yourfile.ext -charset="OEM 850"

                datatraveller1D 1 Reply Last reply Reply Quote 1
                • datatraveller1D
                  datatraveller1 @Alan Kilborn
                  last edited by datatraveller1

                  I would find this option which could be named
                  -charset or maybe more “mordern” -encoding
                  also very useful, so I upvoted your Github issue #8082

                  W 1 Reply Last reply Reply Quote 3
                  • W
                    whitecat @datatraveller1
                    last edited by

                    @datatraveller1
                    @Alan-Kilborn

                    Notepad++ is capable of opening several files at once via command line, so the syntax could be enhanced in order to support opening different files with different charsets:

                    notepad++ yourfile1.ext -charset="OEM 850" yourfile2.ext -charset="UTF-8 BOM"

                    (or similar).

                    Alan KilbornA 1 Reply Last reply Reply Quote 1
                    • Alan KilbornA
                      Alan Kilborn @whitecat
                      last edited by PeterJones

                      @whitecat said in Open Notepad++ via command line with a certain character set:

                      notepad++ yourfile1.ext -charset=“OEM 850” yourfile2.ext -charset=“UTF-8 BOM”

                      That syntax feels “not quite right”.

                      Given the current possible command line is defined like this:

                      notepad++ [–help] [-multiInst] [-noPlugin] [-lLanguage] [-udl=“My UDL Name”] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-monitor] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qn=“Easter egg name” | -qt=“a text to display.” | -qf=“D:\my quote.txt”] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=“d:\your settings dir”] [-openFoldersAsWorkspace] [-titleAdd=“additional title bar text”][filePath]

                      See how filePath is the last thing, and things BEFORE it affect it, e.g. -nLineNumber?

                      IMO, it makes more sense to have your proposed command line work as follows:

                      notepad++ yourfile1.ext -charset="OEM 850" yourfile2.ext -charset="UTF-8 BOM" yourfile3.ext yourfile4.ext

                      • yourfile1.ext would not be affected by any -charset influence
                      • yourfile2.ext would be opened and its encoding set to OEM 850
                      • yourfile3.ext would be opened and its encoding set to UTF-8 BOM
                      • yourfile4.ext would be opened and its encoding set to UTF-8 BOM
                      W 1 Reply Last reply Reply Quote 1
                      • W
                        whitecat @Alan Kilborn
                        last edited by

                        @Alan-Kilborn

                        Yepp - you’re right, this would be more consistent.

                        datatraveller1D 1 Reply Last reply Reply Quote 1
                        • datatraveller1D
                          datatraveller1 @whitecat
                          last edited by datatraveller1

                          I’m wondering who decides if this feature request is implemented? Is there a particular procedure for a feature request?

                          Alan KilbornA 1 Reply Last reply Reply Quote 0
                          • Alan KilbornA
                            Alan Kilborn @datatraveller1
                            last edited by Alan Kilborn

                            @datatraveller1 said in Open Notepad++ via command line with a certain character set:

                            I’m wondering who decides if this feature request is implemented? Is there a particular procedure for a feature request?

                            So the feature request is now an “issue”, which means it can get developer attention. The main author of Notepad++ can work on it, which gives it about a 100% to be accepted into the codebase, when complete. Or, someone else can work on it, and even if they finish a nice implementation on it, there is no guarantee that the author will accept it into the codebase. Or…nothing will ever happen on it (there are a lot of open bug issues, and a lot of other feature request issues).

                            datatraveller1D 1 Reply Last reply Reply Quote 2
                            • datatraveller1D
                              datatraveller1 @Alan Kilborn
                              last edited by

                              @Alan-Kilborn ok, I understand. Thank you!

                              1 Reply Last reply Reply Quote 0
                              • Alan KilbornA
                                Alan Kilborn
                                last edited by Alan Kilborn

                                Earlier I had said:

                                IMO, it makes more sense to have your proposed command line work as follows:

                                notepad++ yourfile1.ext -charset=“OEM 850” yourfile2.ext -charset=“UTF-8 BOM” yourfile3.ext yourfile4.txt

                                While that’s an idyllic command line, logically, it doesn’t really suit how Notepad++ currently works; example:

                                notepad++ -multiInst -n15 yourfile1.txt -n10 yourfile2.txt

                                While this will open “yourfile1.txt” at line 15, it will NOT open “yourfile2.txt” at line 10.

                                But this:

                                notepad++ -multiInst -n15 yourfile1.txt yourfile2.txt

                                will open both files at line 15.

                                So I think it is reasonable to allow only one -charset=... on a command line, that affects all following files; example:

                                notepad++ yourfile1.ext -charset="UTF-8 BOM" yourfile3.ext yourfile4.txt <-- contains only ONE charset directive.

                                If a second -charset is encountered on the command-line, it would be ignored.

                                1 Reply Last reply Reply Quote 2
                                • First post
                                  Last post
                                The Community of users of the Notepad++ text editor.
                                Powered by NodeBB | Contributors