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

      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