textarea newline problem

I am using a database to store and retrieve text for a text area.

In using the latest version of Xojo.
in he text area. Instead of carriage returns, I’m getting question marks inside black diamonds in one line of text.

I;ve tried storing the text with replaceall(t,endofline,"") and then when the text comes in, I'd do replaceall(t,"",endofline).

I still get the same problem - it seems that text area is having a problem with chr(13) or endofline

Try:

http://documentation.xojo.com/index.php/ReplaceLineEndings

Nota: there is a Database Channel (instead of general) and you do not specify the used Data Base name.

[quote=351981:@Emile Schwarz]Try:

http://documentation.xojo.com/index.php/ReplaceLineEndings

Nota: there is a Database Channel (instead of general) and you do not specify the used Data Base name.[/quote]
That’s not right. This is an Encoding issue.

Whenever you pull data from an outside source, you must tell your app what the encoding is. Something like:

data = DefineEncoding(dbdata, encodings.UTF8)

Sorry. Sean ?

Maybe, this will help too: https://blog.xojo.com/2013/08/20/why-are-there-diamonds-in-my-user-interface/

[quote=351978:@Sean Clancy]I am using a database to store and retrieve text for a text area.

In using the latest version of Xojo.
in he text area. Instead of carriage returns, I’m getting question marks inside black diamonds in one line of text.[/quote]

So when you pull Data from the RecordSet you should do something like:

TextArea.Text = RecordSet.Field("theTextField").StringValue.DefineEnconding(Encodings.WindowsLatin1) // Use the Database's Encoding.

And when you push Data:

PreparedStatement.Bind(0, theTextArea.Text.ConvertEncoding(Encodings.WindowsLatin1), mySQLPreparedStatement.SQLTYPE_STRING) // // Use the Database's Encoding again.

Because you are working with UTF8 Encoded Displays and nev to Encode/Decode the Data for the Database, using the Database’s Encoding. So, both Ends using their correct Enconding. UTF8 for your Screen and the Database’s Encoding for … the Database. :wink:

BTW: Code written from my mind without using Xojo IDE. Real Code may varry.

Why WindowsLatin1 and not UTF-8 ?

And if the diamond “character” is not explained in the other thread:
when a font does not have a character, the OS display the replacement character: the “diamond character”…

Was just an example… :slight_smile:

OK.