Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Utf-8 encoding
Message
 
To
09/10/2020 08:55:05
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
01676546
Message ID:
01676600
Views:
49
>Is there a way to convert finished file from ansi to utf-8 :-)? There is a lot of commands to change, but solution is great.
>
>>I need to create file with utf-8 encoding not ansi. File is created with low level functions fputs, fwrite. I can save as utf-8 with notepad or some other tools but I need it from prg. Remark is that is VFP6 so I can't use STRCONV(xx,9) from next version.
>>
>>Thanks in advance.
>
>
>  obj = CreateObject("ADODB.Stream")
>  obj.CharSet = "utf-8"
>  obj.Open()
>  obj.WriteText("Тест за  UTF-8") && Some Cyrillic here :-)
>  obj.SaveToFile("D:\TEST.TXT") && Adjust the path here
>  obj.Close()
>
>
strData = FILETOSTR(GETFILE()) && Read already existed file
obj = CreateObject("ADODB.Stream")
obj.CharSet = "utf-8"
obj.Open()
obj.WriteText(m.strData) 
obj.SaveToFile("D:\TEST.TXT", 2) && Adjust the path here. The second parameter is for overwrite
obj.Close()
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform