eric.dizon
4th March 2019, 19:46
I have a function that creates a HTML file and emails it out to users in a Dal Level. I used a Seq.Open command to create the text file but the issue is the Chinese characters out of LN data fields are not showing properly on the email. Is there any way to defined UTF-8 format inside baan when creating a text file?

Regards,

Eric

cmartin
5th March 2019, 09:58
you can convert a string with utf8.export()

andreas.toepper
5th March 2019, 10:22
I've had some difficulties, too. Basically (and as far as I can tell) you can't create UTF-Files by setting a switch. You need to convert the strings before you are going to write them into your text file.
Basically you store your Chinese text in a multybyte string. Before writing into your file, you need to convert it and store your converted text in string type variable. This variable will contain all special chars of the UTF format.

So creating text file is something like this:


string text.line (2049)
domain tcmcs.str100m russ.text
long fp.sst, i

|read russ, text from table:
select (..)
russ.text = temmm123.field

fp.sst = SEQ.OPEN(file.name,"wt+")

text.line = ""
i = utf8.export(text.line ,russ.text, UTF8_STD_MODE)

SEQ.PUTS(text.line, fp.sst)

SEQ.CLOSE(fp.sst)


That's the way it worked for me.

eric.dizon
5th March 2019, 19:26
Thanks all, andreas.toepper that worked for me too. I found this forum thread that helped solved my issue.
http://www.baanboard.com/baanboard/showthread.php?t=62724&highlight=utf8

eric.dizon
21st March 2019, 14:45
One issue I have when using this utf8.export(dsca,tcibd001.dsca,UTF8_STD_MODE)
when the source string has apostrophe (') in the text, it shows (eg. from pallet's -> pallet����s) instead, any idea on how to handle this exception?

Ajesh
22nd March 2019, 13:50
Try escaping ' by replacing it by "'" and then export it. chr$(34) & "'" & chr$(34)

eric.dizon
22nd March 2019, 14:38
Thanks Ajesh, I will try your suggestion.

eric.dizon
24th April 2020, 17:45
Anybody have ever tried doing t-sql select statement out of LN Text Fields and able to extract the Chinese or MultiByte character out of the SQL Text field directly?