f



How to write unicode text from RTF to a text file

I'm posting again a question I have asked previously in a more simple
way..

We are using RTF control (memo field in a DBF) to store some unicode
description in more than 2 languages (this is for a real estate app
that describes a property in more than 2 languages).

In order to interface with a site, we need to just create a unicode
text (xml) adding some unicode string extracted from this RTF control.
So far we didnt manage to achieve this as all txt created with VO is
ANSI (of cource..) Can anybody suggest a VO solution to this, or do you
think this is impossible?

Thanks a lot for any idea

Stavros

0
Stavros
4/17/2006 9:23:08 PM
comp.clipper.visual-objects 12618 articles. 2 followers. Post Follow

1 Replies
868 Views

Similar Articles

[PageSpeed] 58

Solution to the problem ->

********************************
FUNCTION UnicodeMergeExample()
********************************
LOCAL cText1, cText2 AS STRING
LOCAL oRichedit      AS RichEdit

 * 1. Create a RichEdit Control without owner.
 oRichEdit :=3D RichEdit{ AppShellWindow ,-1, Point{ 0, 0 }, Dimension{
100, 100 } }

 * 2. Set the TextLimit to MAX_ALLOC. If you don't, you may experience
problems with
        *    large data amounts.
 oRichEdit:TextLimit :=3D MAX_ALLOC


 * 2. Get your text data.
        cText1 :=3D "Plain Text"
     cText2 :=3D < RTF DATA FROM Other RichEdit or Field or whatever >

 * 3. Paste them one by one. It works like append at the EOF.
    oRichEdit:Paste( cText1 ) // The plain text
  oRichEdit:Paste( cText2 ) // The unicode text


 * 4. Run the SaveToFile using a unicode option.
 oRichEdit:SaveToFile( "C:\Temp\MyMergedFile.TXT", _OR( SF_UNICODE,
SF_TEXT ) )

 * Note : The SF_UNICODE is : DEFINE SF_UNICODE :=3D 0x10

 * Now, the text file "C:\Temp\MyMergedFile.TXT", has the merged result
of plain
 * and unicode text
 * If you need the text file to be also indentified as unicode and not
just contain,
 * unicode data, you must add 2 bytes at the begining of the text file.
 * The bytes are : CHR(255) + CHR(254)  ( HEX : FF FE )

RETURN NIL
********************************



=CE=9F/=CE=97 Stavros Spanos - www.orbit.gr =CE=AD=CE=B3=CF=81=CE=B1=CF=88=
=CE=B5:
> I'm posting again a question I have asked previously in a more simple
> way..
>
> We are using RTF control (memo field in a DBF) to store some unicode
> description in more than 2 languages (this is for a real estate app
> that describes a property in more than 2 languages).
>
> In order to interface with a site, we need to just create a unicode
> text (xml) adding some unicode string extracted from this RTF control.
> So far we didnt manage to achieve this as all txt created with VO is
> ANSI (of cource..) Can anybody suggest a VO solution to this, or do you
> think this is impossible?
>=20
> Thanks a lot for any idea
>=20
> Stavros

0
Stavros
4/19/2006 1:17:29 PM
Reply: