如何设置代码页导出xml文件ion进度4gl



在生成xml时,我想在命令中生成文件时定义utf-16代码页

hDoc: SAVE ("file", "c:  tmp  lantek.xml"). (export to utf-16) 

您需要使用一个已修复代码页的中间longchar变量。

def var hxdoc   as handle.
def var hxn     as handle.
def var hxnt    as handle.
def var lcc     as longchar.
create x-document hxdoc.
create x-noderef hxn.
create x-noderef hxnt.
hxdoc:create-node( hxn, 'root', 'element' ).
hxdoc:append-child( hxn ).
hxdoc:create-node( hxnt, '', 'text' ).
hxn:append-child( hxnt ).
hxnt:node-value = 'røøt'.
fix-codepage( lcc ) = 'utf-16'. // remove to see difference
hxdoc:save( 'longchar', lcc ).
message 
    length( lcc, 'raw' ) skip
    string( lcc )
    .
copy-lob from lcc to file 'foobar.xml'. // you may need no-convert

当不使用fix-codepage时,长字符的长度为42。当代码页已经被设置为utf-16时,长字符的长度是84。

示例:abldojo.progress.com.

最新更新