I iCAB Well-Known Member Licensed User Longtime User Aug 12, 2016 #1 Hi All The attached file is generating an error with B4I (but not B4A) when loaded using the code below Code: Copy lstLanguageStrings = StringUtils1.LoadCSV(File.DirAssets, "language_strings.csv", ",") Any feedback is greatly apreciated Attachments SampleFile.zip SampleFile.zip 208 bytes · Views: 538
Hi All The attached file is generating an error with B4I (but not B4A) when loaded using the code below Code: Copy lstLanguageStrings = StringUtils1.LoadCSV(File.DirAssets, "language_strings.csv", ",") Any feedback is greatly apreciated
Erel B4X founder Staff member Licensed User Longtime User Aug 14, 2016 #2 Can you post the error message? Upvote 0
I iCAB Well-Known Member Licensed User Longtime User Aug 14, 2016 #3 Hi Erel, here is a little background to help. The original file contains strings used by the application to display various messages. I was able to narrow down the issue to the line I kept in the attached file. I believe it is related to the 3 dots in "This is a test…", if you remove the dots the file will load Thank you for the great support Here is the error message. Code: Copy Error occurred on line: 421 (Lang) Error reading file. Incorrect encoding Stack Trace: ( CoreFoundation <redacted> + 150 libobjc.A.dylib objc_exception_throw + 38 CoreFoundation <redacted> + 0 B4i Example -[B4IFile ReadString2:::] + 500 B4i Example -[B4IFile ReadString::] + 86 B4i Example -[iStringUtils LoadCSV2::::] + 206 B4i Example -[iStringUtils LoadCSV:::] + 48 CoreFoundation <redacted> + 68 CoreFoundation <redacted> + 292 B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1786 B4i Example -[B4IShell runMethod:] + 574 B4i Example -[B4IShell raiseEventImpl:method:args::] + 1998 B4i Example -[B4IShellBI raiseEvent:event:params:] + 1442 B4i Example +[B4IDebug delegate:::] + 52 B4i Example -[b4i_lang _getlanguagestringbyid:] + 442 B4i Example -[b4i_main _pickupanddropoff_callfromresizepage] + 1114 B4i Example -[b4i_main _page1_resize::] + 796 CoreFoundation <redacted> + 68 CoreFoundation <redacted> + 292 B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1786 B4i Example -[B4IShell runMethod:] + 574 B4i Example -[B4IShell raiseEventImpl:method:args::] + 2212 B4i Example -[B4IShellBI raiseEvent:event:params:] + 1442 B4i Example +[B4IObjectWrapper raiseEvent:::] + 220 B4i Example __30-[B4IPanelView layoutSubviews]_block_invoke + 1034 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 B4i Example main + 108 libdyld.dylib <redacted> + 2 ) Upvote 0
Hi Erel, here is a little background to help. The original file contains strings used by the application to display various messages. I was able to narrow down the issue to the line I kept in the attached file. I believe it is related to the 3 dots in "This is a test…", if you remove the dots the file will load Thank you for the great support Here is the error message. Code: Copy Error occurred on line: 421 (Lang) Error reading file. Incorrect encoding Stack Trace: ( CoreFoundation <redacted> + 150 libobjc.A.dylib objc_exception_throw + 38 CoreFoundation <redacted> + 0 B4i Example -[B4IFile ReadString2:::] + 500 B4i Example -[B4IFile ReadString::] + 86 B4i Example -[iStringUtils LoadCSV2::::] + 206 B4i Example -[iStringUtils LoadCSV:::] + 48 CoreFoundation <redacted> + 68 CoreFoundation <redacted> + 292 B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1786 B4i Example -[B4IShell runMethod:] + 574 B4i Example -[B4IShell raiseEventImpl:method:args::] + 1998 B4i Example -[B4IShellBI raiseEvent:event:params:] + 1442 B4i Example +[B4IDebug delegate:::] + 52 B4i Example -[b4i_lang _getlanguagestringbyid:] + 442 B4i Example -[b4i_main _pickupanddropoff_callfromresizepage] + 1114 B4i Example -[b4i_main _page1_resize::] + 796 CoreFoundation <redacted> + 68 CoreFoundation <redacted> + 292 B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1786 B4i Example -[B4IShell runMethod:] + 574 B4i Example -[B4IShell raiseEventImpl:method:args::] + 2212 B4i Example -[B4IShellBI raiseEvent:event:params:] + 1442 B4i Example +[B4IObjectWrapper raiseEvent:::] + 220 B4i Example __30-[B4IPanelView layoutSubviews]_block_invoke + 1034 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 B4i Example main + 108 libdyld.dylib <redacted> + 2 )
Erel B4X founder Staff member Licensed User Longtime User Aug 14, 2016 #4 StringUtils.LoadCSV expects the file to be encoded in UTF8. Your file is encoded in a different encoding so there is an error. You can use File.ReadString2 to load the file. Try it with "Windows-1250" encoding. Then save it to a temporary file with File.WriteString. Upvote 0
StringUtils.LoadCSV expects the file to be encoded in UTF8. Your file is encoded in a different encoding so there is an error. You can use File.ReadString2 to load the file. Try it with "Windows-1250" encoding. Then save it to a temporary file with File.WriteString.
I iCAB Well-Known Member Licensed User Longtime User Aug 14, 2016 #5 Erel said: StringUtils.LoadCSV expects the file to be encoded in UTF8. Your file is encoded in a different encoding so there is an error. You can use File.ReadString2 to load the file. Try it with "Windows-1250" encoding. Then save it to a temporary file with File.WriteString. Click to expand... Sure I will do, but can you please tell me how come the same file works with B4A no problem Thank you Upvote 0
Erel said: StringUtils.LoadCSV expects the file to be encoded in UTF8. Your file is encoded in a different encoding so there is an error. You can use File.ReadString2 to load the file. Try it with "Windows-1250" encoding. Then save it to a temporary file with File.WriteString. Click to expand... Sure I will do, but can you please tell me how come the same file works with B4A no problem Thank you
Erel B4X founder Staff member Licensed User Longtime User Aug 15, 2016 #6 Android is more forgiving when it tries to decode bytes into string. If you check the result you will see that the 3 dots character was not decoded properly in your B4A program as well as it also assumes that the file is encoded with utf8. Upvote 0
Android is more forgiving when it tries to decode bytes into string. If you check the result you will see that the 3 dots character was not decoded properly in your B4A program as well as it also assumes that the file is encoded with utf8.
I iCAB Well-Known Member Licensed User Longtime User Aug 15, 2016 #7 Thank you, it makes perfect sense why the "..." were not displaying properly Upvote 0