Hi. The file is big, and the part that I already posted, which is its beginning, is enough for testing.
But I noticed that things aren't as I think. As a matter of fact, just first 5 has the problem we talked about.
The file is organized in the following way:
NumberOfElements ( Therefore a number)
.. Elements .. (strings)
..........
NumberOfElements (number)
.. etc.
First of all I inform you that, unluckily, applying your suggestion doesn't resolve (with the very first number 5 of the file).
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
If FirstTime=True Then
Dim NomeFileLocale As String : NomeFileLocale="Smas/test_char.txt"
If File.Exists(File.DirRootExternal, NomeFileLocale) Then
Dim TextReader1 As TextReader
TextReader1.Initialize2(File.OpenInput(File.DirRootExternal, NomeFileLocale),"UTF8")
Dim sz As String,l As Int
sz = TextReader1.ReadLine.Trim
sz.Replace($"""$,"") ' <<<<<<< taking away the "
'N=sz ' ERROR
For i=0 To 4 ' << FORCED to read following strings, till next NumberOfElements: SHOULD Be N-1, BUT N=sz gives error..
sz=TextReader1.ReadLine.Trim
Next
sz = TextReader1.ReadLine.Trim
N=sz ' this works.. so the problem is ONLY in the very first NumberOfELements (I hope)
TextReader1.Close
End If
End If
End Sub
Seen with OpenOffice, Just for a brutal sight of the situation, we see that only first 5 has problems..:
5
Não Conhecido 0
Circular 1
Misto 2
Quadrado 3
Rectangular 4
5
Não Conhecido 0
Alvenaria de Pedra 1
Alvenaria de tijolo 2
An├Òis pre-fabricado de bet├úo 3
Betão armado 4
4
Não Conhecido 0
Dom├Òstico 2
Pluvial 3
Unitario 1
10
etc.
Finally seen with an hex editor, we see:
ef bb bf 35 20 20 20 20 20 20 20 20 20 20 20 20 0d 0a <<<<<< Here the 5 has "ef bb bf" before.. Therefore problems ...
4e c3 a3 6f 20 43 6f 6e 68 65 63 69 64 6f20 20 20 30 20 0d 0a
43 69 72 63 75 6c 61 72 20 20 20 20 20 20 20 20 31 0d 0a
4d 69 73 74 6f 2020 20 20 20 20 20 20 20 20 20 32 0d 0a
51 75 61 64 72 61 64 6f 20 20 20 20 20 20 20 20 33 0d 0a
52 65 63 74 61 6e 67 75 6c 61 72 20 20 20 20 20 34 0d 0a
35 0d 0a << here clearly just one char (5) so NO PROBLEM
etc.
This is the situation.. Thanks for your interest.