Android Question Problem on text.lenght with 2 same text

ArminKH

Well-Known Member
hi all
This is so wonderfull
i have a text file(written by notepad) with 1 simple string like "ArminKH"
by using text reader i read my string from text file but today when i log my text.lenght i see wrong result
when i copy my text from log to one line of b4a i see different font for my text but i never change any fonts
please let me to know what is wrong on this simple thing or maybe i am on sleep
please see attached sample code + screen shot + text file
 

Attachments

Last edited:

Peter Simpson

Expert
Licensed User
Hmm strange, 2 different font types (type face). I had big issues with your first log line but your second line worked perfect. Even using the cursor to scroll along the first log line caused issues. Even when I go to Tools > IDE Options > Change Font, and I change the fonts, font style and font size I still had issues with your first log file. Writing the line out manually works perfectly fine though :confused:
 
Last edited:

ArminKH

Well-Known Member
@Erel
Excuse me 4 mention u but i think this question just can be answered by u :(
 

stevel05

Expert
Licensed User
Look at the B4a file using a Hex editor, the text you have pasted has 3 extra values (hex ef,bb and bf) which are presumably changing the displayed font, and causing the string size error.
 

ArminKH

Well-Known Member
Look at the B4a file using a Hex editor, the text you have pasted has 3 extra values (hex ef,bb and bf) which are presumably changing the displayed font, and causing the string size error.
thank u
And what is the solution? Write text file just by using b4a text writer?
 

stevel05

Expert
Licensed User
That may not always be feasible if you need to use third party text files, and it depends on the required use of the file. If you only want a plain text file you could check the Ascii range of it's content and remove unwanted characters. You could duplicate the file first if you want to keep the original intact.
 
Top