pmattes / x3270

Family of IBM 3270 emulators
46 stars 18 forks source link

Need to enter data in Thai language in wc3270 emulator #51

Open FWDQK opened 1 year ago

FWDQK commented 1 year ago

Hi Team, We need to enter values in Thai in wc3270 emulator. Tried using charset and utf8, but same did not worked. Please help to suggest how we can achieve this.

pmattes commented 1 year ago

Assuming that your host supports it, the command-line option '-codepage thai' will set up wc3270 to use code page 1160 when talking to the host. With that, wc3270 should be able to display Thai text from the host and accept Thai input from the keyboard.

For scripts, however, wc3270 uses the system's ANSI code page. You can see what this is by entering 'show localencoding' at the wc3270> prompt. If it shows CP874, then your computer is configured for the Windows Thai code page, and you can use Thai characters (encoded in code page 874) in your scripts. If it shows something else, then scripts won't be able to use Thai characters. To work around this, you can use the '-utf8' command line option. This will switch wc3270 to use UTF-8 encoding for scripts, which allows (UTF8-encoded) Thai characters to be used.

FWDQK commented 1 year ago

show localencoding

Hi, When I have executed wc3270 manually with Language set as Thai, it accepts Thai. But when tried via script, it does not accept (Given Name field is the one where I have entered Thai value)

show localencoding is CP874

What is the syntax to pass utf8 to Open connection? coz when I tried -utf8 it worked, but when I am tryine -utf8 True or so, it fails to launch.

image image

pmattes commented 1 year ago

The correct syntax for the '-utf8' option is here: https://x3270.miraheze.org/wiki/-utf8_command-line_option

FWDQK commented 1 year ago

The correct syntax for the '-utf8' option is here: https://x3270.miraheze.org/wiki/-utf8_command-line_option

Hi, I have already gone through this link. But unable to achieve the correct way to implement in script so that its handled. Please help with script syntax to set it.

pmattes commented 1 year ago

We must somehow be talking about different things. Are you using some sort of separate scripting tool to run your wc3270 session?

'-utf8' is a command-line option, which is passed to wc3270 when you start it, just like '-xrm "wc3270.model: 2"' which I think you are already using.

FWDQK commented 1 year ago

We must somehow be talking about different things. Are you using some sort of separate scripting tool to run your wc3270 session?

'-utf8' is a command-line option, which is passed to wc3270 when you start it, just like '-xrm "wc3270.model: 2"' which I think you are already using.

Yes
Correct So I tried only to pass -utf8, then it launched but was not able to enter data in Thai language. When I tried -utf8:true or -utf8 true, it failed to launch.

Default value for this is false.

pmattes commented 1 year ago

The proper syntax is '-utf8'. It is a Boolean option and does not take a parameter. The fact that the application launched successfully when you just passed '-utf8' indicates that you had passed it correctly.

However... now that I understand that you are using Robot Framework to automate wc3270, rather than wc3270's scripting facility, the '-utf8' option is not going to help you here. '-utf8' only changes the behavior of wc3270 scripts. It does not change wc3270's interactive behavior, and as far as wc3270 is concerned, running under Robot Framework is still interactive use.

As far as I know, entering Thai text should work with wc3270 and Robot Framework as long as the text is encoded as Windows code page 874 https://en.wikipedia.org/wiki/ISO/IEC_8859-11#Code_page874(Microsoft)_/_1162. Again, I have never used Robot Framework, so I don't know how hard getting this encoding right would be.

May I ask what it is you are trying to do by automating wc3270 this way? Are you trying to gather some data from the host (commonly known as screen scraping), or are you trying to actually present the user with the wc3270 display? If you are doing screen scraping, there are definitely easier ways to accomplish this.