I have a TextArea in which i have Text which is loaded from a mySQL Database.
The Text is stored within the Database in Latin1 and is loaded from the recordset with the Defined Encoding Latin1.
Some chars are ISO8859 encoded, so ii use DecodingFromISO8859MBS to convert the Text. The i write it into the TextArea.
When i now try to Split the Text by lines, Xojo does not detect the delimiter.
I tried it with:
.Split(EndOfLine) // Tried it also with EndOfLine.UNIX, EndOfLine.Windows, …
.Split(Chr(13)) and .Split(Chr(10))
.SplitB(Chr(13)) and .SplitB(Chr(10))
Nothing seems to worky.
Why?
Here’s the Code i use to create the String for the TextArea:
[code] If data<>Nil Then
If data.RecordCount > 0 Then
ArticleBody = data.Field(“body”).StringValue.DefineEncoding(Encodings.WindowsLatin1)
ArticleBody = ArticleBody.Mid(ArticleBody.InStr("")+6) 'Wir wollen nur den Teil zwischen den
ArticleBody = ArticleBody.Left(ArticleBody.InStr("")) 'HTML Tags und
ArticleBody = RemoveHTMLTagsMBS(ArticleBody)
ArticleBody = DecodingFromQuotedPrintableMBS(ArticleBody) 'Alle Escape-Codierten Zeichen zurück in lesbare Zeichen wandeln
End If
data.Close
End If
End If
End If
[quote=117299:@Sascha S]I have a TextArea in which i have Text which is loaded from a mySQL Database.
The Text is stored within the Database in Latin1 and is loaded from the recordset with the Defined Encoding Latin1.
Some chars are ISO8859 encoded, so ii use DecodingFromISO8859MBS to convert the Text. The i write it into the TextArea.
When i now try to Split the Text by lines, Xojo does not detect the delimiter.
I tried it with:
.Split(EndOfLine) // Tried it also with EndOfLine.UNIX, EndOfLine.Windows, …
.Split(Chr(13)) and .Split(Chr(10))
.SplitB(Chr(13)) and .SplitB(Chr(10))
Nothing seems to worky.
Why?
Here’s the Code i use to create the String for the TextArea:
[code] If data<>Nil Then
If data.RecordCount > 0 Then
ArticleBody = data.Field(“body”).StringValue.DefineEncoding(Encodings.WindowsLatin1)
ArticleBody = ArticleBody.Mid(ArticleBody.InStr("")+6) 'Wir wollen nur den Teil zwischen den
ArticleBody = ArticleBody.Left(ArticleBody.InStr("")) 'HTML Tags und
ArticleBody = RemoveHTMLTagsMBS(ArticleBody)
ArticleBody = DecodingFromQuotedPrintableMBS(ArticleBody) 'Alle Escape-Codierten Zeichen zurück in lesbare Zeichen wandeln
End If
data.Close
End If
End If
End If
[quote=117312:@Sascha S]Strange, but it works perfectly!
Thank you @Jeremy Cowgar :)[/quote]
ReplaceLineEndings takes the text passed and standardizes ANY line ending in the text to the line ending you pass. The method call looks silly, a lot of people ask “What does that accomplish” but it does a lot. So, the initial call standardizes the line endings to EndOfLine which is whatever the standard line ending is on the executing operating system. You then split by that line ending in the .Split() call.
[quote=117299:@Sascha S]I have a TextArea in which i have Text which is loaded from a mySQL Database.
The Text is stored within the Database in Latin1 and is loaded from the recordset with the Defined Encoding Latin1.
Some chars are ISO8859 encoded, so ii use DecodingFromISO8859MBS to convert the Text. The i write it into the TextArea.
When i now try to Split the Text by lines, Xojo does not detect the delimiter.[/quote]
I think there is a catch here. Your source is not a TextField being typed on a system. Your source is text in a DB. Let’s suppose you make a software with 2 clients, one Windows and another Mac. Your DB should have mixed contents. This way, maybe you should normalize the text before writing (my prefered is EndOfLine.UNIX) and decode it to the current system before using it in a UI.