baan1612
30th August 2017, 14:15
Hi,

How can we export the Chinese language text data into a file ?

vamsi_gujjula
1st September 2017, 22:09
are you talking abt text field . or as such description fields with Chinese language ??

if its description fields yes you can export using UTF encoding .

I think even text should be possible but never tried it.

baan1612
15th September 2017, 13:49
Thanks for your reply !

I am able to export, but the outcome comes out to be like this -

北京信邦电子有限公司;;›%Õñ›%ÐË›%·9›%ºÅ;›%²ý›%ƽ›%Çø›%¿Æ›%¼¼›%Ô°›%Çø;;102200;›%±±›%¾©

I have tried UTF encoding functions too.. but doesn't seem working.

Can you give some examples on how to use the UTF encoding functions.
Much thanks !

vamsi_gujjula
15th September 2017, 19:34
Our LN is set up for Unicode Mode ... attached the picture

I think a UTF BOM seq is required at beginning of the file ( but not mandatory for all applications)

delimiter is a comma in this case


function boolean create.file.and.write.header()
{
string dummy(30) mb
fp = seq.open(creat.tmp.file$( bse.tmp.dir$()),"wt+",file)
| fp = seq.open("Customer_details_" & dte$() & ".txt","wt+",file)

if fp < 1 then
return(false)
endif
|BOM
seq.puts(chr$(239) & chr$(187) & chr$(191),fp)


line = concat$(delimiter,
tt.label.desc ("tctccom100.bpid",ttadv.cont.general,dummy),
tt.label.desc ("tctccom100.nama",ttadv.cont.general,dummy),
tt.label.desc ("tctccom110.crep",ttadv.cont.general,dummy),
tt.label.desc ("gbcom4401m000s01",ttadv.cont.general,dummy),
tt.label.desc ("tctcmcs013.cpay",ttadv.cont.general,dummy),
tt.label.desc ("tctccom112.crlr",ttadv.cont.general,dummy),
tt.label.desc ("tctcmcs143.cste",ttadv.cont.general,dummy),
get.desc.of.cdf.field("5glk"),
get.desc.of.cdf.field("4khd"),
get.desc.of.cdf.field("1hyf"),
get.desc.of.cdf.field("6qyj"),
tt.label.desc ("tctcmcs031.cbrn",ttadv.cont.general,dummy),
get.desc.of.cdf.field("2ywx"),
get.desc.of.cdf.field("3qyx"),
tt.label.desc ("tctcmcs029.cbtp",ttadv.cont.general,dummy),
tt.label.desc ("tctcgen.cadr",ttadv.cont.general,dummy),
tt.label.desc ("tctcnama",ttadv.cont.general,dummy),
tt.label.desc ("tctcmcs010.ccty",ttadv.cont.general,dummy),
tt.label.desc ("tctccom130.city",ttadv.cont.general,dummy),
tt.label.desc ("gbcom4400m000s01",ttadv.cont.general,dummy)
)

ret = utf8.export(unicode.line,line,UTF8_STD_MODE)
seq.puts(unicode.line,fp)
return(true)
}


function write.data()
{
if not isspace(text) then
search.and.replace(text,","," ")
search.and.replace(text,chr$(10),chr$(09))
endif

line = concat$("|",
trim$(tccom100.bpid),
trim$(tccom100.nama),
trim$(tccom110.crep),
trim$(crep.nama),
trim$(tccom112.cpay),
tccom112.crlr,
trim$(tcmcs143.dsca),
trim$(tccom110.cdf_5glk),
trim$(tccom110.cdf_4khd),
trim$(tccom110.cdf_1hyf),
trim$(tccom110.cdf_6qyj),
trim$(tccom110.cbrn),
trim$(tccom110.cdf_2ywx),
trim$(tccom110.cdf_3qyx),
trim$(tccom110.cbtp),
trim$(tccom100.cadr),
trim$(tccom130.nama),
trim$(tcmcs010.dsca),
trim$(tccom139.dsca))

search.and.replace(line,","," ")
search.and.replace(line,"|",",")
line = trim$(line)&chr$(44)&text
utf8.export(unicode.line,line,UTF8_STD_MODE)
seq.puts(unicode.line,fp)

}