BaBernd
11th November 2015, 09:40
Hello to All,
I create a text file (csv/txt) out of a multibyte field during executing a report. The correct umlaute (ü,ä,ö) will be transformed into (›¼ü, ›¼ä, ›¼ö). Where does these additional signs (›¼) come from?
for text file creation I use the following code:
declaration:
string buf(1,1) based |dynamic Array
string filename(512) |file name
string textbuffer(4096) | buffer for item text
long xml.text
long xml.fp |XML-Filepointer
long xml.root |root-Node
long xml.item |article-Node
long xml.ret |return value
Detail.1:
before.layout:
textbuffer = ""
free.mem(buf) |reinit from array buffer
select tttxt002.nlin
from tttxt002
where tttxt002._index1 = {:tcibd001.txta, :lattr.textlang$}
selectdo
endselect
alloc.mem(buf,132,tttxt002.nlin)
xml.ret = text.to.buf("tcibd001.txta",lattr.textlang$,tttxt002.nlin,buf)
for xml.i = 1 to tttxt002.nlin
textbuffer = textbuffer & trim$(buf(1,xml.i)) & " "
endfor
xml.text = xmlnewdataelement("ARTIKELBEZ",trim$(textbuffer), xml.item)
| creating the file
after.program:
if xml.root then
filename = "ITEMS-" & trim$(sprintf$("%u(%04Y-%02m-%02d-)%U(%02h-%02m-%02s)",utc.num(),utc.num())) & "-" & logname$ & ".xml"
xml.fp = seq.open(filename, "wt+")
xml.ret = xmlwritepretty(xml.fp, xml.root, 0)
xml.fp = seq.close(xml.fp)
xml.ret = server2client(filename, "c:\temp\" & filename, true)
xml.ret = start.application.local("excel.exe c:\temp\" & filename, false, xml.ret)
endif
It's not the full code but the important parts (I think so):
- text.to.buf()
- xmlwritepretty()
From which one of These functions I will get These additional signs "›¼"?
Best Regards
Bernd
I create a text file (csv/txt) out of a multibyte field during executing a report. The correct umlaute (ü,ä,ö) will be transformed into (›¼ü, ›¼ä, ›¼ö). Where does these additional signs (›¼) come from?
for text file creation I use the following code:
declaration:
string buf(1,1) based |dynamic Array
string filename(512) |file name
string textbuffer(4096) | buffer for item text
long xml.text
long xml.fp |XML-Filepointer
long xml.root |root-Node
long xml.item |article-Node
long xml.ret |return value
Detail.1:
before.layout:
textbuffer = ""
free.mem(buf) |reinit from array buffer
select tttxt002.nlin
from tttxt002
where tttxt002._index1 = {:tcibd001.txta, :lattr.textlang$}
selectdo
endselect
alloc.mem(buf,132,tttxt002.nlin)
xml.ret = text.to.buf("tcibd001.txta",lattr.textlang$,tttxt002.nlin,buf)
for xml.i = 1 to tttxt002.nlin
textbuffer = textbuffer & trim$(buf(1,xml.i)) & " "
endfor
xml.text = xmlnewdataelement("ARTIKELBEZ",trim$(textbuffer), xml.item)
| creating the file
after.program:
if xml.root then
filename = "ITEMS-" & trim$(sprintf$("%u(%04Y-%02m-%02d-)%U(%02h-%02m-%02s)",utc.num(),utc.num())) & "-" & logname$ & ".xml"
xml.fp = seq.open(filename, "wt+")
xml.ret = xmlwritepretty(xml.fp, xml.root, 0)
xml.fp = seq.close(xml.fp)
xml.ret = server2client(filename, "c:\temp\" & filename, true)
xml.ret = start.application.local("excel.exe c:\temp\" & filename, false, xml.ret)
endif
It's not the full code but the important parts (I think so):
- text.to.buf()
- xmlwritepretty()
From which one of These functions I will get These additional signs "›¼"?
Best Regards
Bernd