Import csv character problem or XML

sigster

Active Member
Licensed User
Longtime User
Hi I am try to find out how to import XML into database
did search the forum but did not see a sample

I have csv file I download and it work well with DBUtils.InsertMaps but then I have character problem the file I import I need to download the file so I can not fix the file before I download

Regards
Sigster
 

Yafuhenk

Active Member
Licensed User
Longtime User
Is it possible to upload the csv file so that some of us can have a look to see if the character problem you talk about can be solved?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Your file is encoded with Windows-1252 character set.
You can properly read the string with:
B4X:
   Dim tr As TextReader
   tr.Initialize2(File.OpenInput(File.DirAssets, "bpost.txt"), "Windows-1252")
   Log(tr.ReadAll)
   tr.Close

StringUtils.LoadCSV only works with UTF8 files. If you want to use it you will need to first write the string to a temporary file with File.WriteString.
 
Upvote 0

sigster

Active Member
Licensed User
Longtime User
Thanks this works well

B4X:
    Dim tr As TextReader
tr.Initialize2(File.OpenInput(File.DirAssets, "bpost.txt"), "Windows-1252")
Log(tr.ReadAll)
tr.Close

Regards
Sigster
 
Upvote 0
Top