i have spend hours looking for the problem. I have this code that
loadcsv:
Dim strSQL As String = "INSERT into tbldice (category,question) VALUES "
For Each myrow() As String In su.LoadCSV (Dir,FileName,";")
strSQL = strSQL & "("
For Each strData As String In myrow
strSQL = strSQL & "'" & strData & "',"
Next
strSQL = strSQL.SubString2(0,strSQL.Length-1)
strSQL = strSQL & "),"
Next
strSQL = strSQL.SubString2(0,strSQL.Length-1) & ";"
Main.sql.execnonquery(strSQL)
then when i did a "SELECT DISTINCT category from tbldice" i found out that loadcsv added a strange and undisplayed unicode at the beginning of the data. When i copied and pasted the log to dbfiddle i found out its adding "ZERO WIDTH NO-BREAK SPACE" with the unicode 65279 to the beginning of the string.
you can take a look at the testdb and run the "SELECT DISTINCT category from tbltest", you will notice that category "aa" is duplicated because of the unseen unicode.
the file is generated by excel and i cant find the extra unicode character in the file. please look at the csv file attached. I am copying it from my gdrive to my avd to test it. Not sure if that has anything to do with the extra character Infront but i doubt it
Lol I am on the arse-end side of the world, and presumably you are not, so from your perspective I am the nightshift support person. Things are pretty quiet here. ?
Two immediately-obvious and (relatively) simple solutions are:
1/ su.LoadCSV into a Map variable, and then for the first field of the first row, do a .Replace(Chr(0xFEFF), "") on it
2/ load the file into a String variable, delete the first character if it is Chr(0xFEFF), write it back to a temporary file, then su.LoadCSV from that
with the bonus that solving the issue at your end means that your users don't need to do anything special when exporting data to your app.
Lol I am on the arse-end side of the world, and presumably you are not, so from your perspective I am the nightshift support person. Things are pretty quiet here. ?
oh you are from aussie, the land down under as i gather from your profile. I am in your country's next door neighbor, Indonesia. You are night support for a company i presume. since you have the label expert for b4x, that means you have been using the language for a while. Thank you so much
In that case then we are in the same day/night phase.
The bit about nightshift is a joke for people in continents other than Australia or Asia - they are often surprised to be getting reasonably good support from the forum in the middle of the night their time eg 3am.
Which island are you on? We visited Lombok just before covid became popular, it was very nice.
I didn't dare drive, though ? which is pretty funny because in a previous life I was a driving instructor (here in Australia).
i am in the capital. Jakarta. Lombok or labuan bajo is really nice. lots of aussies here. dont drive. taxis and ride hails are plenty and affordable.
btw you are full time support for anywhere software(b4x) or for another company not related to b4x?