diff --git a/src/native/get.cc b/src/native/get.cc index 9b262c7..1dfce9b 100644 --- a/src/native/get.cc +++ b/src/native/get.cc @@ -72,4 +72,9 @@ int tn3270_get_length(h3270::session *ses) { return (int) ses->get_length(); -} + } + + int tn3270_get_display_charset(h3270::session *ses, char* str, int len) { + strncpy(str,ses->get_display_charset().c_str(),len); + return 0; + } diff --git a/src/native/private.h b/src/native/private.h index e8b859b..b2e46c9 100644 --- a/src/native/private.h +++ b/src/native/private.h @@ -115,6 +115,10 @@ DLL_PUBLIC int tn3270_get_width(h3270::session *ses); DLL_PUBLIC int tn3270_get_height(h3270::session *ses); DLL_PUBLIC int tn3270_get_length(h3270::session *ses); + + DLL_PUBLIC int tn3270_set_display_charset(h3270::session *ses, const char* str); + DLL_PUBLIC int tn3270_get_display_charset(h3270::session *ses, char* str, int strlen); + } diff --git a/src/native/set.cc b/src/native/set.cc index bc07362..ea4e914 100644 --- a/src/native/set.cc +++ b/src/native/set.cc @@ -46,4 +46,10 @@ int tn3270_set_cursor_addr(h3270::session *ses, int addr) { return 0; } +int tn3270_set_display_charset(h3270::session *ses, const char* str) { + debug("%s(%s)",__FUNCTION__,str); + ses->set_display_charset(0,str); + return 0; +} + diff --git a/src/pw3270-sharp/pw3270-sharp.cs b/src/pw3270-sharp/pw3270-sharp.cs index 86db968..77080cd 100644 --- a/src/pw3270-sharp/pw3270-sharp.cs +++ b/src/pw3270-sharp/pw3270-sharp.cs @@ -128,6 +128,12 @@ namespace pw3270 { [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] extern static int tn3270_get_length(IntPtr Session); + [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] + extern static int tn3270_set_display_charset(IntPtr Session, string str); + + [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] + extern static int tn3270_get_display_charset(IntPtr session, StringBuilder str, int strlen); + /// /// Create a new session with lib3270/pw3270 /// @@ -435,6 +441,18 @@ namespace pw3270 { } } + public string CharSet { + get { + StringBuilder str = new StringBuilder(31); + tn3270_get_display_charset(hSession,str,30); + return str.ToString(); + } + set { + tn3270_set_display_charset(hSession,value); + } + } + + } } diff --git a/testprograms/sample.cs b/testprograms/sample.cs index 78480c0..5ab23bd 100644 --- a/testprograms/sample.cs +++ b/testprograms/sample.cs @@ -37,6 +37,7 @@ class sample { System.Console.WriteLine("Using pw3270 version " + host.Version + " revision " + host.Revision); System.Console.WriteLine("Screen size is " + host.Width + "x" + host.Height + " (" + host.Length + ")"); + System.Console.WriteLine("The Charset is " + host.CharSet); host.Connect("tn3270://zos.efglobe.com:telnet",10); -- libgit2 0.21.2