C catyinwong Active Member Licensed User Longtime User Mar 15, 2019 #1 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?
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?
DonManfred Expert Licensed User Longtime User Mar 16, 2019 #2 catyinwong said: Any suggestion to fix the problem? Click to expand... Where is the project which shows the issue? Upvote 0
catyinwong said: Any suggestion to fix the problem? Click to expand... Where is the project which shows the issue?
C catyinwong Active Member Licensed User Longtime User Mar 16, 2019 #3 DonManfred said: Where is the project which shows the issue? Click to expand... Attachments JdbcSQL-utf8 testing.zip JdbcSQL-utf8 testing.zip 8.4 KB · Views: 597 Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Mar 17, 2019 #4 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. Upvote 0
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.
C catyinwong Active Member Licensed User Longtime User Mar 17, 2019 #5 Erel said: 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. Click to expand... is there an example code for base64 encoding and decoding? Upvote 0
Erel said: 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. Click to expand... is there an example code for base64 encoding and decoding?
DonManfred Expert Licensed User Longtime User Mar 17, 2019 #6 The forumsearch is working https://www.b4x.com/android/forum/pages/results/?query=base64 - https://www.b4x.com/android/forum/threads/base64-encode-decode-image-library.31031/#content Upvote 0
The forumsearch is working https://www.b4x.com/android/forum/pages/results/?query=base64 - https://www.b4x.com/android/forum/threads/base64-encode-decode-image-library.31031/#content
C catyinwong Active Member Licensed User Longtime User Mar 17, 2019 #7 DonManfred said: The forumsearch is working https://www.b4x.com/android/forum/pages/results/?query=base64 - https://www.b4x.com/android/forum/threads/base64-encode-decode-image-library.31031/#content Click to expand... sorry i am confused. do you mean it should decode it to bitmap? and then how to encode it to string? I mean, how to turn the bitmap to filename and folder path? Upvote 0
DonManfred said: The forumsearch is working https://www.b4x.com/android/forum/pages/results/?query=base64 - https://www.b4x.com/android/forum/threads/base64-encode-decode-image-library.31031/#content Click to expand... sorry i am confused. do you mean it should decode it to bitmap? and then how to encode it to string? I mean, how to turn the bitmap to filename and folder path?
DonManfred Expert Licensed User Longtime User Mar 17, 2019 #8 Use Encryption Library. Code: Copy 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 Code: Copy ' Read the base64 from db ' and decode it Dim decoded As String = b64.DecodeStoS(base64str,"UTF8") Log($"Base64 decoded = ${decoded}"$) Upvote 0
Use Encryption Library. Code: Copy 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 Code: Copy ' Read the base64 from db ' and decode it Dim decoded As String = b64.DecodeStoS(base64str,"UTF8") Log($"Base64 decoded = ${decoded}"$)
Erel B4X founder Staff member Licensed User Longtime User Mar 17, 2019 #9 StringUtils also supports base64 encoding and decoding. Upvote 0