Thursday, June 15, 2006

this test app can break

Wow. I didn't expect a post about a little-used Windows API function to generate 30,000 page views. In any event, some folks still doubt the "IsTextUnicode()" explanation, so I'm putting up the test app that I used to validate my theory before I blogged it.

Just run the app, and enter a string into the edit control. As you type, the app repeatedly calls IsTextUnicode() and shows both the result (Unicode/not Unicode) and the flags that IsTextUnicode() returns to indicate which tests it used.

Updated:I had pasted in the relevant chunk of the app source code, but it appears this blog template chokes on 70-column preformatted text. If you really want it, drop me a line.

3 comments:

Greg Givler said...

It is interesting, I read your entry about this problem yesterday. A quick experience, I used Webmatrix to develop a Company Intranet in ASP.NET 1.0 and 1.1. My colleage was using Dreamweaver to do the static page design of the rest of the site. Anytime we did a publish, my pages would turn into gobblety-gook. It turns out that Webmatrix was putting 2 unprintable characters in each of my pages. Probably the characters you were talking about to determine the Unicode stuff. When Dreamweaver saw this, it would just puke all over my code. So I wrote a little application to copy my completed pages over to our Dreamweaver repository that chopped the first two bytes of each of my aspx files off, so that Dreamweaver would like it. I never knew what caused it, just that it happened. Thanks for finally two years later explaining why.

Anonymous said...

I've noticed something in notepad that has been bugging me for the past few days -- in fact, Googling for the bug is what got me here.

When I press Ctrl-s to save a document, my input cursor moves back 2-10 spaces. I've only started to notice this on my new Core Duo, so maybe there's a problem there?

Just writing in the hopes you'll go into a full-blown investigation like you did here :)

Patrick_ said...

I have your same problem: though it only occurs on a line which has been word-wrapped (of course, word-wrapping must be enabled). If you are able to notice, _whenever_ you save something in Notepad (CTRL+S), the cursor moves to the very beginning, but it's quickly moved back to it's original position. Try holding in CTRL+S... it's a bit easier to see.