Square characters in text file.

Monkeh

Member
Licensed User
Longtime User
Hi,

I'm trying to display a series of text files as the help section of my app.

I'm using the HelpScrollView code as kindly provided by Klaus.

My problem is that the CR/LF seems to appear as a square character. I've used notepad++ to save the text files as UTF-8 and as UTF-8 without BOM and also tried to change the code so that it uses initialize2 and specified utf-8. Everything I've tried so far still displays the text file with squares at the CR/LF points.

It's not a major thing and I could probably use another solution but it would be nice to be able to display text in this way without displaying annoying little squares at the end of each sentence/paragraph.

:sign0085:
 

Monkeh

Member
Licensed User
Longtime User
OK.

I was using a Samsung Galaxy Spica (I5700) as my development phone.

Just tried using an emulator and the text file displays fine.

So, I'm assuming that different devices may display text files differently. Is there a way to ensure that a text file will display the same across all devices?

Tired now and going to bed but will test on a Galaxy S3 when I wake up.:)
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Android uses chr(10) as the end of line character. I guess that your file uses chr(13) & chr(10).

You can use this code:
B4X:
Dim sb As StringBuilder
sb.Initialize
For Each Line As String In File.ReadList(File.DirAssets, ...)
 sb.Append(Line).Append(CRLF) 'this adds chr(10)
Next
Return sb.ToString
 
Upvote 0
Top