Forgot your password?
typodupeerror
Bug

FornaxChemica's Journal: Bush hid the facts... AGAIN!

Journal by FornaxChemica

First, let's remember â" I know I didn't: Bush hid the facts

Today, I spent most of the day doing some tests with PHP, writing binary and text strings to files. Later in the day, when I was about to stop, I opened one of the files I had written to that was supposed to contain 10000 numeric characters. But to my utmost incomprehension it was filled with a garble of Chinese characters!

I had been playing around with binary strings so I thought I must have messed up somewhere in my code. I check everything, remove lines until nothing else but the string generation and writing sequence remain, but the file still comes up in Chinese characters! It's an encoding problem clearly, and I get confirmation of this when reading the file from PHP, the content is intact. When reading the output text file from a remote server, it opens normally. My PHP code looks like this by then:

$t=""; $v=0; for($i=1; $i code won't display here *sigh*

If I change $v==100 for 99 or 101, then the file content appears normal. On the other hand, if I replace the 10000 with 1000, I still get the Chinese characters. After more testing, I come to realize that it has nothing to do with PHP. It's just the character sequence in the file. Somehow I'm too confident (and stupid) and don't come to think the issue might be with Notepad.

What seem to me the most logical explanations at this point are: 1/ it's a bug in Vista (I've seen many as I've never upgraded from the original; usually they don't disturb me much) 2/ it's a fault in the RAM that produces a corrupted byte or something (I guess it doesn't make any sense, but I had so many hardware problems in the past I'm just waiting for more) 3/ CHINESE HACKERS GOT ME! (or the yellow peril over Internet)

Somehow I'm too confident (and stupid) and don't come to think the issue might be with Notepad. I desperately try to look for someone on Twitter or Facebook who could help me test and replicate the bug. If the same happens to another Windows user, then I'm safe. But in all likelihood I will need to find another Vista user and possibly one with the same old version as mine, which will prove difficult. For starters, I don't know many people.

Finally, I find someone (thank you Narayan!) who helps me test and, to my surprise, replicate the bug in Windows 7, no less. She's smart enough to also try open the file in other text editor. I use Notepad for everything so doing this didn't come to me naturally, I don't even have another text editor (or just Worpad, somewhere deep down in my hard drive).

And here you have it, Notepad is even more buggy than thought. Contrary to what Wikipedia states:

This bug does not occur in Windows Vista and Windows 7 because their version of IsTextUnicode has been altered to make it much more likely to guess a byte-based encoding rather than UTF-16LE.

It does still occur. Looks like Microsoft will need to make further alterations to get their simplest text editor work as well as the competition. Sad but true.

And for those who'd like to test, here's the line:

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798990123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989901234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798990123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989901234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798990123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989901234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798990

You must copy it as such, in one line without carriage return, in a .txt file. It's 1900 bytes long. Then open it with Notepad. There's surely a way to reduce it, if someone wants to try...

This discussion has been archived. No new comments can be posted.

Bush hid the facts... AGAIN!

Comments Filter:

"Let every man teach his son, teach his daughter, that labor is honorable." -- Robert G. Ingersoll

Working...