iOS Question LoadCSV problem

highflyer

Member
Licensed User
Longtime User
Reading a csv file with the following code, I'm not able to get proper data.

B4X:
    Dim su As StringUtils
    Dim Table As List
    If File.Exists(File.DirDocuments, "em.csv") = False Then
        File.Copy(File.DirAssets, "em.csv", File.DirDocuments, "em.csv")
    Else
        Table = su.LoadCSV(File.DirDocuments, "em.csv", ",")
        Log(Table)
    End If


Application_Start
<B4IList: (
"<B4IArray: 0x1666b6a0>",
"<B4IArray: 0x16630b30>",
"<B4IArray: 0x16631410>",
"<B4IArray: 0x1665cda0>",
"<B4IArray: 0x166275e0>"
)>
Application_Active
 

Attachments

  • em.txt
    281 bytes · Views: 224

KY Leng

Member
Licensed User
Longtime User
Below is my code:

Dim SU As StringUtils
Dim TB As List
Dim iRow As Int
Dim FileDirectory As String
'----------------------------------------------------------
FileDirectory = File.DirAssets
Log(FileDirectory)
TB.Initialize
TB = SU.LoadCSV(FileDirectory,"TelecomLaw.csv","|") 'Line 472
'----------------------------------------------------------


And I got the error as below:

Error occurred on line: 472 (Main)
Error reading file. Incorrect encoding
Stack Trace: (
CoreFoundation <redacted> + 150
libobjc.A.dylib objc_exception_throw + 38
CoreFoundation <redacted> + 0
Telecom Law -[B4IFile ReadString2:::] + 500
Telecom Law -[B4IFile ReadString::] + 86
Telecom Law -[iStringUtils LoadCSV2::::] + 206
Telecom Law -[iStringUtils LoadCSV:::] + 48
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 292
Telecom Law +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1786
Telecom Law -[B4IShell runMethod:] + 574
Telecom Law -[B4IShell raiseEventImpl:method:args::] + 1998
Telecom Law -[B4IShellBI raiseEvent:event:params:] + 1442
Telecom Law __33-[B4I raiseUIEvent:event:params:]_block_invoke + 74
libdispatch.dylib <redacted> + 10
libdispatch.dylib <redacted> + 22
libdispatch.dylib _dispatch_main_queue_callback_4CF + 1532
CoreFoundation <redacted> + 8
CoreFoundation <redacted> + 1590
CoreFoundation CFRunLoopRunSpecific + 516
CoreFoundation CFRunLoopRunInMode + 108
GraphicsServices GSEventRunModal + 160
UIKit UIApplicationMain + 144
Telecom Law main + 108
libdyld.dylib <redacted> + 2
)

Any idea please ?
 
Upvote 0
Top