Per-client codepage detection and handling

This commit is contained in:
Matthew R. Wilson committed 2025-11-25 16:31:09 -08:00
1 parent 1859568369
commit 7b7d375e91
14 files changed
+349 -109

No files matched your search

+3 -2
View File
@@ -48,7 +48,7 @@ var helpScreen = go3270.Screen{
// generator function for it is a stand-alone function and not a method on the
// session.
func help(returnTransaction go3270.Tx) go3270.Tx {
return func(conn net.Conn, _ go3270.DevInfo, data any) (
return func(conn net.Conn, devinfo go3270.DevInfo, data any) (
go3270.Tx, any, error) {
_, err := go3270.HandleScreen(
helpScreen, // the screen to display
@@ -58,7 +58,8 @@ func help(returnTransaction go3270.Tx) go3270.Tx {
nil,
"errormsg", // name of field to put error messages in
23, 79, // cursor coordinates
conn)
conn,
devinfo.Codepage())
if err != nil {
return nil, nil, err
}
+6 -4
View File
@@ -58,7 +58,7 @@ var loginScreenRules = go3270.Rules{
// login transaction accepts a string value in data if the login screen
// should be initialized with an error message.
func (sess *session) login(conn net.Conn, _ go3270.DevInfo,
func (sess *session) login(conn net.Conn, devinfo go3270.DevInfo,
data any) (go3270.Tx, any, error) {
fieldValues := make(map[string]string)
@@ -81,7 +81,8 @@ func (sess *session) login(conn net.Conn, _ go3270.DevInfo,
go3270.AIDClear},
loginErr, // name of field to put error messages in
4, 16, // cursor coordinates
conn)
conn,
devinfo.Codepage())
if err != nil {
return nil, nil, err
}
@@ -170,7 +171,7 @@ type newuserData struct {
errmsg string
}
func (sess *session) newuser(conn net.Conn, _ go3270.DevInfo, data any) (
func (sess *session) newuser(conn net.Conn, devinfo go3270.DevInfo, data any) (
go3270.Tx, any, error) {
fieldValues := make(map[string]string)
@@ -195,7 +196,8 @@ func (sess *session) newuser(conn net.Conn, _ go3270.DevInfo, data any) (
},
loginErr, // name of field to put error messages in
4, 16, // cursor coordinates
conn)
conn,
devinfo.Codepage())
if err != nil {
return nil, nil, err
}
+6 -4
View File
@@ -79,7 +79,7 @@ type mainmenuData struct {
// mainmenu transaction accepts a mainmenuData struct as the data if the
// option field or error message should be populated.
func (sess *session) mainmenu(conn net.Conn, _ go3270.DevInfo, data any) (
func (sess *session) mainmenu(conn net.Conn, devinfo go3270.DevInfo, data any) (
go3270.Tx, any, error) {
fieldValues := make(map[string]string)
@@ -107,7 +107,8 @@ func (sess *session) mainmenu(conn net.Conn, _ go3270.DevInfo, data any) (
},
mainmenuError, // name of field to put error messages in
1, 13, // cursor coordinates
conn)
conn,
devinfo.Codepage())
if err != nil {
return nil, nil, err
}
@@ -183,7 +184,7 @@ var exampleScreen = go3270.Screen{
// exampleFeature is a transaction that will act as a placeholder for real
// application functionality. It accepts a string in the data which will
// be displayed on the panel.
func (sess *session) exampleFeature(conn net.Conn, _ go3270.DevInfo,
func (sess *session) exampleFeature(conn net.Conn, devinfo go3270.DevInfo,
data any) (go3270.Tx, any, error) {
fieldValues := make(map[string]string)
@@ -210,7 +211,8 @@ func (sess *session) exampleFeature(conn net.Conn, _ go3270.DevInfo,
},
mainmenuError, // name of field to put error messages in
23, 79, // cursor coordinates
conn)
conn,
devinfo.Codepage())
if err != nil {
return nil, nil, err
}