I have already set the language of the sql server to be in utf8. When I update the data, the characters seem to be saved properly because I can select the correct rows using ExecQuery. But the jdbcresultset.getstring method doesn't read the right string and the strings become ???? when being read. Any suggestion to fix the problem?
You can add the charSet parameter to the connection string: charSet=UTF8
It does change the ResultSet charset (you can see it in the debugger) though the returned string is wrong. Maybe the database is not configured properly.
As a workaround you can store the text encoded with base64 string and decode it on the client.
You can add the charSet parameter to the connection string: charSet=UTF8
It does change the ResultSet charset (you can see it in the debugger) though the returned string is wrong. Maybe the database is not configured properly.
As a workaround you can store the text encoded with base64 string and decode it on the client.
Dim teststring As String = "dhhjdfhshf jjkdjjk hsdjk fhsj kh fjksdf hs"
Dim b64 As Base64
Dim base64str As String = b64.EncodeStoS(teststring,"UTF8")
Log($"Base64 (write it to DB) = ${base64str}"$)
and decode the string back
B4X:
' Read the base64 from db
' and decode it
Dim decoded As String = b64.DecodeStoS(base64str,"UTF8")
Log($"Base64 decoded = ${decoded}"$)