Fog Creek Software
Discussion Board




Chars 128 to 255, Notepad and Windows edit control

I have an app which generates data including the funky characters ASCII 128 to 255. Eventually it should show them in a multi-line edit control

Look at the output in DOS EDIT, it's fine

Look at the output in Notepad, and certain of the funky characters magically disappear (most don't but enough to wreck the output)

I haven't yet test on a multi-line edit control, but as notepad is basically a window with save round one of these controls, I'm worried (and expect) to see the same behavior

Is there some rule in Windows about chars 128 to 255, which ones get lost and when?

If so, where?

S. Tanna
Saturday, January 31, 2004

Scratch this question

Turns out there is a wierd bug in Notepad, but even this can be worked round

I had gone into Panic mode, on the fear, that my user interface design was about to need to be redesigned.

S. Tanna
Saturday, January 31, 2004

You definitely use Unicode and 16bit character representation so why worry about 128-255 range? :)

WildTiger
Saturday, January 31, 2004

I need to run on Win95 and up

The output is itself 8-bit data, as it's final destination ain't in Windows.

S. Tanna
Saturday, January 31, 2004

You're out of luck. Code positions 128-255 are _not_ ASCII characters. The ASCII standard is a 7-bit standard that only goes up to 127.

Windows has a gazillion different code pages that each give different meaning to the upper 128 characters, and outside of Windows there are another gazillion different standards.

Portability for non-Unicode 8-bit characters does not exist. You'll have to identify one code page that works for all your target machines, and stick with that. Very likely you'll be able to use only a subset of the 128-255 range, though.

Chris Nahr
Saturday, January 31, 2004

Notepad is the wrong particular hammer in this case.

Simon Lucy
Saturday, January 31, 2004

Oddly enough, I don't care what these characters look like, at all.

They merely have to appear as something in a multi-line edit control, and be preserved through a clipboard copy and paste.

They seem to be, even in Notepad. Like I said the problem is solved.


What had me confused for a brief moment, was how Notepad handles a sequence of CR LF CR  (i.e. extra CR).  There is definitely some wierdness in there which can run thru to alter other parts of the text, like these characters.

S. Tanna
Saturday, January 31, 2004

I would not be surprised if this characters could turn into garbage during copy/paste if some of them are not supported in default code page.

The answer actually depends on what are you trying to achieve - if you know what encodings are deafult for your clients then no need to worry. Otherwise verifying that any character from 128-255 makes sence in all (including DBCS) encoding will be fun.

WildTiger
Sunday, February 01, 2004

DOS Edit uses OEM codepage. Notepad uses Windows code page.

These are simply 2 different codepages.

Use OemToChar() and CharToOem() to convert from one to the other.

Serge Wautier
Wednesday, February 04, 2004

*  Recent Topics

*  Fog Creek Home