Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word and CodePages
Message
From
14/11/2001 18:53:19
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00580898
Message ID:
00581844
Views:
19
>Jeremy,
>
>I do not know how to change a Code Page, but I do know how to avoid conflict.
>At least, it works for me. Try this:
>*------------------
>close table all
>create curs temp (lceuro c(1))
>insert into temp values (chr(128))
>insert into temp values (chr(128))
>copy to c:\temp1 sdf
>lcstr=filetostr("c:\temp1.txt")
>lcstr=strtran(lcstr, chr(128), chr(255)+chr(254)+chr(172)+chr(32))
>strtofile(lcstr, "c:\temp2.txt")
>*-----------------------------------
>
>Two text files will be seen differently in MS Word.
>I will appreciate if you share with me another solution if any.

If I'm understanding this right, you're basically converting the textfile to UTF-8, giving it a proper UTF-8 header. In that case, the transformation could be done programmatically on the whole textfile using StrConv() function - tough I haven't been too lucky with it, whenever I tried to use UTF-8 as the target, it gave me Ascii again. But it does give Unicode - if this helps any. Couldn't get it to produce proper UTF-8, mainly because it doesn't list the locale IDs (third parameter) that I need for testing. The conversion does work backwards, it converts UTF-8 back to ascii, even though it misconverts a few.

OK, after some experimenting, got it: UTF text should be prefixed by CHR(255)+CHR(254) and Word should be told it's a UTF-8 file. The downside is that you still need to know your Locale ID to do the conversion well.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform