Unhandled Runtime Exception - invalid character

Hello,

When reading in this string, I get an invalid character - and it only happens on this string. Not others that are similar.

204691F-1F810001-35353636-34393438-34353532-34393635-3730FFFF-FFFFFFFF-FFFFFFFF-FFFFFFFF-DBD46283-DD7C0000-00010005-00010190-FFFE4B03-5A696F6E

Unhandled RuntimeException
Message: Encountered invalid character.

Stack:
Xojo.Data.GenerateJSON%y%x
WebResponse._Render%s%o
WebSession._HandleEvent%%oso<_HTTPServer.HTTPRequestContext>
WebSession._HandleRequest%i4%oso<_HTTPServer.HTTPRequestContext>
WebApplication._HandleHTTPRequest%%oo<_HTTPServer.HTTPRequestContext>
_HTTPServer.HTTPRequestThread.Event_Run%%o<_HTTPServer.HTTPRequestThread>

All of my classes and methods have error handling in them. Where could this be coming from? Any ideas what to look for?

Thanks,
Tim

I’d guess that there’s an invisible character in there.

Check the encoding and make sure it’s UTF8.

1 Like

Hi Greg,

I was able to finally narrow down where the error is occurring - on this code:
cntCntrlLocalLicInfo.fldSiteName.Text = Session.License.LicensedFeatures.SiteName

My questions are,

  1. how to make sure it is UTF8?
  2. Why is it not using the error handling code in the method that this code resides?

Thank you,
Tim

You will want to check to see if the SiteName has an encoding. If it does, use ConvertEncoding, if not, use DefineEncoding.

Because the conversion to JSON for transmission to the browser happens later, after all of your code has finished running.