CRLF stored in DB do not display on iPhone when retrived


#1

Try again.
In my app, I save text from a multi-line textarea to an SQLite database.
When I retrieve the data to a multi-line textarea on Android the text breaks where there are CR/LFs.
Text saved and retrieved on iPhones does not save the line breaks. The text is all returned as a run-on sentence.

I am NOT saving HTML text; just straight ASCII.

My question is, how do I insert CRs or LFs or both on an iPhone so that the text displays as it was saved?

Thanks
JamesF


#3

Which control are you displaying in? You say textarea, but which framework?

How are you assigning the value to the textarea?


#4

Bootstrap textArea

txtNote.value


#5

To be more specific.

User type in the textArea(BS) and the ‘value’ is stored in the database.
dbField=txtArea.value
When I retrieve the data, it displays properly when assigned as follows:
txtArea.value= dbField
Except on an iPhone
The text has 0 or more CR/LFs. The CR/LFs do not display on an iPhone.


#6

To be more specific.

User type in the textArea(BS) and the ‘value’ is stored in the database.

dbField=txtArea.value

When I retrieve the data, it displays properly when assigned as follows:

txtArea.value= dbField

Except on an iPhone

The text has 0 or more CR/LFs. The CR/LFs do not display on an iPhone.


#7

From BASIC, the vbCR character works fine as a line separator:

txtArea.value = “Line 1” & vbCR & “Line 2”

Give it a try!

If that works for you, it could mean the data in the database does not have the return in it.


#8

The database has the return in it.

The line separator is there in Windows and on the Android. I save many paragraphs of data containing line separator in the database and there is no problem retrieving and displaying the data, with all the line separators in place, on an Android phone.

The problem is that the iPhone ignores the line separator in the retrieved data.

<Android Example (Saved and retrieved)>

To do list:

Do this

Do that

Do the other

</Android Example>

<iPhone Example (Saved and retrieved)>

To do list:Do thisDo thatDo the other

</iPhone Example>


#9

Did you try the experiment I suggested?


#10

The forum software stripped out the code headers

Examples:

Android:
To do list:

Do this

Do that

Do the other

iPhone:
To do list:Do thisDo thatDo the other


#11

Yes.

And yes, it does work fine as a line separator.

But not on the iPhone.

Obviously, I am not making myself clear.

I have a multi-lined Bootstrap TextArea in my app. I enter random data including carriage returns and line feeds as one normally does in a multi-line text box.

I retrieve the data back into the same TextArea at a later date.

The carriage returns and line feeds are still there: on the Android phone.

On the iPhone, the carriage returns and line feeds do not exist.

When retrieving the data, I have tried to replace the vbCRLF in the text with vbCR, “\n”, “\n”, “\r\n”, “\U2028”, “\U+2028”, etc. Before assigning it to the TextArea.value. It does not work


#12

Did you try that statement on an iPhone?

I did, and it worked for me. The objective is to determine whether the problem is with the data or the textbox. My test pointed to the data.


#13

I have been trying that and similar statements on the iPhone for 3 months and it does not work.

Did you save the TextArea.value, with all it’s CR/LFs to an SQLite database and then retrieve it back into the TextArea.value? It comes back from the database with all the original CR/LFs . Works in Windows, Android and even Blackberry; but not the iPhone.

There is a problem in the way the TextArea is implemented either in NS Basic or in Bootstrap for the iPhone.


#14

Have you tried the exact statement I asked on the iPhone?

txtArea.value = "Line 1" & vbCR & "Line 2"

If it works (as it does for me) the problem is not with the TextArea but with the data.


#15

Just tried that and it does not work


#16

Try this:

https://www.nsbasic.com/i/Project24/


#17

So, to be sure we are talking about the same thing.

Can you save text (with line breaks) in a database and then retrieve the SAME data that was saved? This is iPhone only btw.


#18

Please, could you answer my question? I have asked it a few times in different ways.

Does the sample I asked you to try work properly on your iPhone?


#19

And as I said, yes, your sample works.

But your sample does not demonstrate the issue.


#20

You asked me if this worked:

txtArea.value = “Line 1” & vbCR & "Line 2"
No it did not.

You sent me a link to a project which worked , I suppose, but did not demonstrate the problem.


#21

Thank you. I didn’t notice anywhere where you said it worked.

The sample has exactly this statement in it:

Textarea1.value="George" & vbCR & "henne"

This tells me that Textinput is working fine, and that the problem is in the database. I don’t know of any problems saving data in iPhone databases - it’s the same code as in Chrome. They both use the same underlying WebKit library. I suspect there is a problem with the data going into the database.