Some ANSI characters read from ISAM files do not display correctly in WPF TextBox controls
Customer has an application that is reading an indexed file which contains sveral fields defined as PIC X.
These fields may contain ANSI characters like the German ä/ö/ü/ß"...
After reading a record and moving a field containing these characters to a TextBox control the characters are not being displayed properly.
The move statement looks like:
move field1 to textBox1::Text
How can these characters be displayed correctly in the textbox control?
If the field that you are reading in is defined as PIC X then it will be read as ANSI data.
The TextBox::Text property uses Unicode as do all .NET strings so the data needs to be converted before it is displayed.
The following example will work where my-ansi-field would contain German characters read from a file:
01 my-ansi-field pic x(5).
01 myarray type Byte.
set myarray to my-ansi-field
set self::textBox1::Text to type System.Text.Encoding::Default::GetString(myarray)