PDA

View Full Version : Annoying Escape Character Squares in Notepad



firetheGlazer
07-16-2008, 09:25 AM
Hello,
I'm generating text files using C and prefer to use notepad to open the results. Whenever something uses and escape character (eg "\n"), notepad will display a box character. When I open up the same document in any other text editor, the boxes turn into the proper format. If I then save it using that program and the same name and extension, I can open notepad and see my document formatted correctly.

Example:

I open "data.dat" and I see:


[NOTEPAD]
#1 10 3.0 (box)#2 11 1.0 (box)...
[WORDPAD]
#1 10 3.0
#2 11 1.0
...
[AFTER SAVING IN WORDPAD AND GOING BACK TO NOTEPAD]
#1 10 3.0
#2 11 1.0
...

It's not a problem or anything, it's just very annoying to use this intermediate step. This become especially apparent when notepad's memory-light structure is able to open something wordpad can't (eg 40,000+ lines). Sometimes though, I just have to break down and use a UNIX head,tail, or more.

Any thoughts?

matsp
07-16-2008, 09:28 AM
You are either:
1. creating the data file in Linux/Unix and copying it to Windows.
2. opening the file in binary form (e.g. fopen("mydata.txt", "wb")).

In case 1, you need to use some sort of "unix2dos" tool to translate the file before using notepad [or use a text-editor that understands newlines without carriage returns, such as wordpad].
In case 2, just remove the b when creating the file, so that it's a text-file to the system, rather than a binary.

--
Mats

DavidP
07-16-2008, 10:22 AM
I am weary of Wordpad because it can mangle things similar to how Microsoft Word mangles things. I suggest Notepad++. Or you could also output a "\r\n" instead of just "\n".

Salem
07-16-2008, 11:27 AM
Definite to notepad++.
The view whitespace will show you what crazy combination of spaces, tabs, \r and \n you have.
Failing that, there's also a "view in hex" for getting down to the most basic level of bytes.

dwks
07-16-2008, 12:00 PM
Either the file has some non-Windows newlines, or you're typing the characters yourself. Are you pressing CTRL-ENTER or SHIFT-ENTER, by any chance? I think that creates a box character like that . . . .

Elysia
07-17-2008, 02:49 AM
Problem is that notepad shows \n as squares for some stupid reason. Proper newlines of Windows is \r\n. Wordpad, word and other software (Notepad++ too, I believe?) shows \n correctly as newlines, however.

guesst
07-17-2008, 01:25 PM
Why does Microsoft keep releasing that dysfunctional program? It works, yes, but only most of the time, and yet it's been around since, what 3.1 isn't it? You'd think they could've polish on it at some point.

Then again, the software company I work for has let so many little bugs that we know about and just haven't wanted to spend the time to fix, so I guess it's a pretty universal phenomenon.

VirtualAce
07-17-2008, 08:38 PM
Started using Notepad++ and I'll never go back.

Mario F.
07-17-2008, 09:41 PM
Did you folks see the computer he was offered (http://www.digitaltigers.com/stratosphere-metropolitan3000.php) by one of the users when his cat ruined the former one sometime last year? (link shows a more recent model. He got the 2120, but I can't find it)

Yup. Notepad++ here too.

maxorator
07-18-2008, 12:37 AM
Yup. Notepad++ here too.
Me too. Awesome little app. :)

Elysia
07-18-2008, 01:05 AM
Why does Microsoft keep releasing that dysfunctional program? It works, yes, but only most of the time, and yet it's been around since, what 3.1 isn't it? You'd think they could've polish on it at some point.
Well, they have polished it pretty much, but not enough to see \n as newlines, apparently.
It's one thing I'd like to see fixed, though.


Then again, the software company I work for has let so many little bugs that we know about and just haven't wanted to spend the time to fix, so I guess it's a pretty universal phenomenon.
Amen to that. Heh.

maxorator
07-18-2008, 02:17 AM
Well, they have polished it pretty much, but not enough to see \n as newlines, apparently.
It's one thing I'd like to see fixed, though.
Maybe it's good that they don't polish it too much. This way more people will start looking for better alternatives.