Zoomba Zoomba

Funny: How to Break Windows Notepad

Funny: How to Break Windows Notepad

It's not a bug! It's unintended irony!

Here's a really funny way to break Notepad that a coworker showed me this morning. I bet this is one of those jokes that's been around for ages, but this was the first I ever heard of it, so it's new to me.

This actually works. It will not crash your computer, it just breaks Notepad in that it causes it to display very oddly. No perm damage comes of the following steps.

Here's how to do it:
1. Open up Notepad (not Wordpad, not Word or any other word processor)
2. Type in this sentence exactly (without quotes): "this app can break"
3. Save the file to your hard drive.
4. Close Notepad
5. Open the saved file by double clicking it.

Instead of seeing your sentence, you should see a series of squares. For whatever reason, Notepad can't figure out what to do with that series of characters and breaks :)

Again, it doesn't crash the app or anything, it's just a funny little twise of fate/unintended feature :)
126,255 views 37 replies
Reply #26 Top
after a few tries, i got the following pattern:

xxxx xxxxxxx yyy....

the positions of the 2 blanks mattered, just letters -- no digits or other symbols, and as long as the total number of characters is even then Notepad will break.

looks like a bug rather than an egg. but i'm curious what's the logic behind this...
hmmm, what if some of the x's are replaced with real Unicode characters?...
Reply #27 Top
nope, can't insert Unicode into the file.
if you do, Notepad saves the file in Unicode format (even if you specify ASCII), which doubles the filesize and tags FFFE at the beginning.
Reply #28 Top
this is what we call BUG.

try putting adding a carriage (return) at the end of the line.
notepad will then properly handle it...
Reply #29 Top
Not just Notepad -- saving and opening the same string in Metapad produces the same results.

Looking at the hex, it seems to be saving fine -- the bytes. Changing anything other than the letters in "break" (said other including adding or deleting any of it), or substituting any charcter other than the lower-case alphabet (61 to 7A), for any letter of those last five, makes it display properly, again, in both of the -pads I tried it in.

e.g.

Displays properly:
this app can breaka
this app can brea
this app can breaK
qhis app can break
this app canbreak
this app can break[carriage return]

Still broken:
this app can qwert

My guess is that this collection of characters is somehow interpreted as malformed unicode-16 by whatever common sense is applied to distinguishing between the various characters encodings by text editors -- it's a bug, but on a much more abstract scale than Notepad being a shitty app.
Reply #30 Top
It's not a bug in the core logic or in the translator, nor is it an easter-egg; it's simply a matter of what the defaults for notepad are. When you save a file in notepad, the default is "ANSI" (it's in a dropdown with other choices). When you open a file in notepad (File->Open), apart from the file path, you specify the file format, the default is "Unicode" (UTF-16), with "ANSI" and "UTF-8" as other choices. When you double-click a file, all notepad has is the filepath, it wasn't given the format, so it just uses the default Unicode when auto-detecting fails. Auto-detecting fails when CRLF is missing under all possible attempted formats. If you hit a newline after the sentence, the file would open correctly under the ANSI format.

If the default format to open were the same as the default format to save, this wouldn't confuse end-users.

No, I have never worked for Microsoft. I used to work for Oracle, and I have seen similar auto-detection failures when trying to simplify the user experience by not asking for the values of unknown variables.

Cheers,
thoreaulylazy
Reply #31 Top
My observations on this bug.
1) Its happens only when entered for first time after we open the notepad program.
2) when it is saved in any other encoding format other than ANSI, it wont happen.
3) It is happening only when the first 18 characters are 4letter word(space) followed by 2 three letter words(space in between) and then a five letter word.Including digits its happening. above this if the total characters are even, its happening.
4)If the phrase contains any Upper case letters in between other than 1st and last character, it wont happen again.
Though I could hear the reason as "
1) You are saving to 8-bit Extended ASCII (Look at the Save As / Encoding format)

2) You are reading as 16-bit UNICODE (You guessed it, look at the Save As / Encoding format)

This is why the 18 8-bit characters are being displayed as 9 (obviously not supported by your codepage) 16-bit UNICODE characters"
I would like to conclude that why it is happening for short peice of text?
2)If we erase the Junk characters and re type phrase "Bush hid the facts" or "aaaa aaa aaa aaaaa" or "1111 111 111 1111" , it is appearing fine.

The reason what I would hear for this is "Text files containing UTF-16 is supposed to start with a BOM, so you can read those two chars and the application will know it is UTF-16. But so many applications does not do that (you have probably noticed the two small chars Notepad adds to the start of a file sometimes),

So what should a poor Notepad do? Well, it can alwys use the IsTextUnicode() Win32 API. YOu pass it some text, and it tries to guess if it is Unicode or not. But what if you just give it so little text, and maybe even just lowercase? Well, then it isn't too easy to tell if it really was unicode or not you gave it. And in these small strings you guys have found, it yes indeed does break. Poor Notepad gets the blame for a bad API, and other faulty apps.."
more interesting links
http://blogs.msdn.com/michkap/archive/2006/06/14/631016.aspx
Reply #32 Top
Here is another explanation of this, which I happened to read after reading this here: http://blogs.msdn.com/oldnewthing/archive/2006/06/14/630864.aspx
Reply #35 Top
pc world (in oz) did a section about it in the back of the magazine this month. apparantly "pies are the shizz" does not work.
Reply #36 Top
thoreaulylazy just completely killed the ride

thanks, guys, i found this post thoroughly amusing