When running my app that gets some data and forwards this to a remote datalog app, locally everything runs fine.
However after deployment I get an unhandled exception:
Unhandled Xojo.Core.BadDataException
Message: String must have a known encoding
Stack:
String.$ToText%y%s
RunPage.RunPage.store_data%%o<RunPage.RunPage>s
RunPage.RunPage.MyDialog_Dismissed%%o<RunPage.RunPage>o<Modal1.Modal1>
Delegate.IM_Invoke%%o<Modal1.Modal1>
AddHandler.Stub.39%%
WebDialog._ExecuteEvent%b%osA1v
WebControl.!_ExecuteEvent%b%ssA1v
WebSession._HandleEvent%%oso<_HTTPServer.HTTPRequestContext>
WebSession._HandleRequest%i4%oso<_HTTPServer.HTTPRequestContext>
WebApplication._HandleHTTPRequest%%oo<_HTTPServer.HTTPRequestContext>
_CGIGateway.GatewayRequestThread.Event_Run%%o<_CGIGateway.GatewayRequestThread>
It concerns a call to my RunPage.store_data method because commenting this out results in the error disappearing.
That method has 2 lines of code:
URL = "https://onk.com/temp/store_data.php?var="+mydata
my_http.SEND("GET", URL.toText)
(note that the store_data here in the URL is the name of the remote datalogger, not of my local method)
The error ‘String must have known encoding’ suggests that it has to do with the encoding of the string URL.
But why doesn’t this result in error when running locally (and indeed acting as intended at the remote websites ‘store_data.php’)
What is even more mysterious that a similar call (with a mydata that is nearly the same) later in the coding doesn’t result in a runtime error.