Carriage Return showing in notepad++ but not textp

2019-04-25 23:36发布

I have some text files copied out to a server. I typically use and prefer notepad++ to look at text files but on this server, only textpad is installed. This is really strange behavior but I noticed that when I view the EOL chars in notepad++ I can clearly see and search for the CRLF (i.e. \r\n). But when I display the same files in textpad, I am able to search only on the LF (\n) and do not have any hits on the CR (\r). Am I missing something really simple on how Textpad is interpreting the EOL chars? I did search online and look at the help but couldn't find anything mentioning this. Thanks in advance for your assistance!

Thanks!!

Kim

3条回答
何必那么认真
2楼-- · 2019-04-26 00:19

This happens when the EOL control characters are not correct. Windows represents newlines with the carriage return + line feed.

In Notepad++, you can check for these characters by selecting:

View > Show Symbols > [x] Show End of Line

notepad++

You need to modify your script so your data is formatted like this:

CRLF

查看更多
Explosion°爆炸
3楼-- · 2019-04-26 00:23

I know this is a slightly old question, but I struggled with this exact problem, and here is how I found a workaround.

When using Save As in textpad you can specify the file format at the bottom (PC, UNIX, or Mac). If you choose UNIX in theory this ends lines only with the \n character, however you have to change this option every time.

You can change the preferences for specific "Document Classes" to specify the output file format. Follow these steps:

  • Click Configure
  • Go to Preferences
  • Expand the Document Classes list
  • Select bash, which should include *.sh files
  • Scroll down the options on the right until you see Create new files as
  • Select UNIX

This should now save all *.sh files you create as UNIX format without the carriage returns. Good luck

I found this info here: http://homes.ori.org/~keiths/Files/Tips/Software_TextPad_Prefs.html#DocClasses

查看更多
小情绪 Triste *
4楼-- · 2019-04-26 00:36

Yes ideally it's carriage return and followed by line feed,

\r\n

but you can also use a quick shorthand to place {lf} rather then {cr}{lf}

\n

查看更多
登录 后发表回答