Have a web app that displays a list box that gets populated from MySql. I’m getting this in the exception and am not sure what it is referring to as I’m not doing anything with Json.
We are though. Data is sent to the browser as JSON and that implies UTF8. Check to make sure all of the text youre putting into the listbox has an Encoding because data coming out of a database often does not.
I just changed the statement to: self.SQLExecute(“Set Names ‘utf8_general_ci’”)
That got rid of the exception, but the listbox doesn’t get populates. I output one of the MySql fields to a local log with every iteration of the while loop. The log shows it went through the look, just didn’t populate the listbox.
Here’s the while loop:
[code]While not rs.eof
’
'System.DebugLog
App.WriteLog(rs.Field(“Company Name”).StringValue)
’
if lsCompany <> rs.Field(“Company Name”).StringValue then
lbFirst = True
lstProviders.AddRow rs.Field(“Company Name”).StringValue
lsCompany = rs.Field(“Company Name”).StringValue
end
lstProviders.AddRow( " -----", rs.Field(“Title”).StringValue, rs.Field(“Contact Person”).StringValue, rs.Field(“Email”).StringValue)
rs.MoveNext
’
’
Set a breakpoint on the line that assigns lsCompany. If you inspect it, I suspect the encoding will still be Nil. If so, youll have to call DefineEncoding on that.
I typically use a String extension method:
[code]function UTF8(extends s as String) as String
If s.encoding = Encodings.UTF8 then
Return s
End if
If s.Encoding is Nil then
Return DefineEncoding(s, Encodings.UTF8)
End if
Return ConvertEncoding(s, Encodings.UTF8)
End Function[/code]