Open Notepad++ via command line with a certain character set
-
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.
-
@whitecat The AutoCodepage plugin might be useful for you.
-
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.
-
@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"
-
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 -
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).
-
@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
-
Yepp - you’re right, this would be more consistent.
-
I’m wondering who decides if this feature request is implemented? Is there a particular procedure for a feature request?
-
@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).
-
@Alan-Kilborn ok, I understand. Thank you!
-
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.