Highlighted
Absent Member.
Absent Member.
2128 views

WPF TextBox german text

Jump to solution

Hi!

I read a isam file with german letter like "ä/ö/ü/ß"...

On debug time i can see the right letter...

if i make a move like this:

move ort to textBox1::Text

then there is a bug in the textBox1:Text it looks like then ASCII not ANSI!?

What is wrong?

 

 

Best Regards

Bernd Riemke

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: WPF TextBox german text

Jump to solution

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 works for me 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)

-----------

This may not be the best way to do this and I am open to suggestions from others but it appears to work correctly on my system.

When you state that this works correctly in C#, how are you reading the data into the C# program if it resides in an ISAM file?          

Thanks.

View solution in original post

0 Likes
3 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: WPF TextBox german text

Jump to solution

Hallo Herr Riemke

Try to call the following statement before reading the file:

CALL  "PC_WIN_SET_CHARSET" USING BY VALUE 0.    

*> This sets up so that all conversions are ANSI

Freundliche Grüsse

Werner Lanter

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: WPF TextBox german text

Jump to solution

It's wrong!

The file is ANSI!

The Compiler Show me the right text

But if i let run the the WPF side the text is wrong!!!

It is not a part of converting!!!

It is a bug in the Compiler!

C# and VB is working with this data well!

Best Regards

Bernd Riemke

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: WPF TextBox german text

Jump to solution

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 works for me 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)

-----------

This may not be the best way to do this and I am open to suggestions from others but it appears to work correctly on my system.

When you state that this works correctly in C#, how are you reading the data into the C# program if it resides in an ISAM file?          

Thanks.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.