Re: A bit RTF-ed off.

2016-07-09 Thread richmond
I was using 7.1.4 because I was attempting to set up an exercise for my 
progging pupils;
and for various pretty obvious reasons we are working with 7.1.4 at the 
moment.


I must find a 100% reliable RTF pumper-outer for Linux.

Richmond.

On 07/09/2016 06:13 AM, Kay C Lan wrote:

As I assume you are now using LC8 Indy (to that generous person, God
bless you and your family) I'll point out two entries in the LC8
Dictionary which I know you're having trouble accessing:

Under 'textDecode':

It is highly recommended that any time you interface with things
outside LiveCode (files, network sockets, processes, etc) that you
explicitly textEncode any text you send outside LiveCode and
textDecode all text received into LiveCode. If this doesn't happen, a
platform-dependent encoding will be used (which normally does not
support Unicode text).

It is not, in general, possible to reliably auto-detect text encodings
so please check the documentation for the programme you are
communicating with to find out what it expects. If in doubt, try
UTF-8.

Under 'RTFText':

Note: Unfortunately, OpenOffice does not have particularly good rtf
import / export capabilities (it doesn't even round-trip correctly
through itself!) and thus copying / pasting of lists between LiveCode
and OpenOffice will not work reliably or correctly.

Important: Because the RTF standard does not include the box,
threeDbox, and link styles supported by LiveCode, the RTFText property
does not necessarily include all information necessary to reproduce
the style information in a chunk. To export and re-import field
information without losing any style information, use the
htmlTextproperty instead.

So I think your script should look something like:

set the RTFText of fld "myRTF" to textDecode(myFile,"CP1252")

Obviously CP1252, could be UTF-16BE, UTF-8, ASCII or any of the other
recognised formats like "ISO-8859-1" which I see is a Linux only
format.

HTH

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: A bit RTF-ed off.

2016-07-09 Thread richmond

"What version of LC are you using for this?"

I was using 7.1.4.

I prepared the document to import in AbiWord ("Shabby Word"),
and a second time in LibreOffice 5.

Having said that: my last Stable release of my Devawriter Pro was 
authored with 4.5

and it imported RTF files that "Behaved themselves" completely.

Richmond.

On 07/08/2016 11:42 PM, J. Landman Gay wrote:

On 7/8/2016 10:31 AM, Richmond wrote:
So, I imported an RTF file into a list field and tired to look at 
char 3,

but I have a feeling that the RTF was piling in as double-byte stuff
as it didn't work at all.

When I copy-pasted the stuff out of the original RTF file intil a 
text file

and imported that (as Text rather than RTFtext) everything worked.
Would be grateful if someone "in the know" could either confirm
or put me right on this one.


What version of LC are you using for this? If it's before version 7 
then you probably need to play with uniEncode/decode from or to 
UTF16/UTF8. (I don't remember the order of the transformations, you'd 
know better than I. My brain erased everything I used to know about it 
as soon as the ease of LC 7 appeared.)


If it's LC 7 or higher then all text files are automatically converted 
to UTF16 when you import them, but an RTF file probably needs to go 
through textEncode before putting it into the field. It helps to know 
what unicode the original is saved as, but when in doubt, it's usually 
UTF8.





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: A bit RTF-ed off.

2016-07-08 Thread Kay C Lan
As I assume you are now using LC8 Indy (to that generous person, God
bless you and your family) I'll point out two entries in the LC8
Dictionary which I know you're having trouble accessing:

Under 'textDecode':

It is highly recommended that any time you interface with things
outside LiveCode (files, network sockets, processes, etc) that you
explicitly textEncode any text you send outside LiveCode and
textDecode all text received into LiveCode. If this doesn't happen, a
platform-dependent encoding will be used (which normally does not
support Unicode text).

It is not, in general, possible to reliably auto-detect text encodings
so please check the documentation for the programme you are
communicating with to find out what it expects. If in doubt, try
UTF-8.

Under 'RTFText':

Note: Unfortunately, OpenOffice does not have particularly good rtf
import / export capabilities (it doesn't even round-trip correctly
through itself!) and thus copying / pasting of lists between LiveCode
and OpenOffice will not work reliably or correctly.

Important: Because the RTF standard does not include the box,
threeDbox, and link styles supported by LiveCode, the RTFText property
does not necessarily include all information necessary to reproduce
the style information in a chunk. To export and re-import field
information without losing any style information, use the
htmlTextproperty instead.

So I think your script should look something like:

set the RTFText of fld "myRTF" to textDecode(myFile,"CP1252")

Obviously CP1252, could be UTF-16BE, UTF-8, ASCII or any of the other
recognised formats like "ISO-8859-1" which I see is a Linux only
format.

HTH

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: A bit RTF-ed off.

2016-07-08 Thread J. Landman Gay

On 7/8/2016 10:31 AM, Richmond wrote:

So, I imported an RTF file into a list field and tired to look at char 3,
but I have a feeling that the RTF was piling in as double-byte stuff
as it didn't work at all.

When I copy-pasted the stuff out of the original RTF file intil a text file
and imported that (as Text rather than RTFtext) everything worked.
Would be grateful if someone "in the know" could either confirm
or put me right on this one.


What version of LC are you using for this? If it's before version 7 then 
you probably need to play with uniEncode/decode from or to UTF16/UTF8. 
(I don't remember the order of the transformations, you'd know better 
than I. My brain erased everything I used to know about it as soon as 
the ease of LC 7 appeared.)


If it's LC 7 or higher then all text files are automatically converted 
to UTF16 when you import them, but an RTF file probably needs to go 
through textEncode before putting it into the field. It helps to know 
what unicode the original is saved as, but when in doubt, it's usually UTF8.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


A bit RTF-ed off.

2016-07-08 Thread Richmond

So, I imported an RTF file into a list field and tired to look at char 3,
but I have a feeling that the RTF was piling in as double-byte stuff
as it didn't work at all.

When I copy-pasted the stuff out of the original RTF file intil a text file
and imported that (as Text rather than RTFtext) everything worked.
Would be grateful if someone "in the know" could either confirm
or put me right on this one.

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode