VFP 5 COPY TO命令

时间:2016-06-02 06:53:13

标签: unicode visual-foxpro

我需要将光标信息复制到使用UTF-8编码的文本文件中。

我目前的命令是: -

COPY TO (FILE NAME) DELIMITED WITH CHARACTER ";"

默认情况下,文本文件已保存为ANSI,如何将其保存为UTF-8?

编辑:我正在使用VFP 5.

3 个答案:

答案 0 :(得分:0)

我不确定,尝试使用StrConv()

strconv(filetostr(文件名),10)

答案 1 :(得分:0)

1.将所有字符备忘录字段转换为UTF-8:

update table1 set field1=STRCONV(field1, 9)

这会将所有非ANSI字符转换为UTF-8编码。

  1. 使用 COPY TO 命令将其导出。

答案 2 :(得分:0)

要扩展Oleg的建议,您可以循环浏览给定表格中的所有字段......

USE C:\SomePath\YourTable.dbf
*/ Get list of all fields in the table's structure
lnF = AFIELDS( laF, "YourTable" )
lcUpdFlds = ""
*/ Prepare a field for allowing comma between multiple fields
*/ but first time in is the "SET" command instead.
lcNextFld = "set "
FOR lnI = 1 TO lnF
   */ Is it a character-based field
   IF laF[ lnI, 2] = "C" OR laF[ lnI, 2] = "M" 
      lcFld = laF[ lnI, 1]
      lcUpdFlds = lcUpdFlds + lcNextFld + lcFld + " = STRCONV( " + lcFld + ", 9) " 
      */ Any subsequent character based fields will have a COMMA
      */ added between them.
      lcNextFld = ", "
   ENDIF
ENDFOR 

更新YourTable& lcUpdFlds

修改为执行一个更新命令并点击所有列与运行多个更新...特别是在LARGER表上