Page 1 of 1

SetOutputCharacterSet

Posted: Wed Mar 20, 2013 3:59 pm
by holger_b
Hi all,

I am having difficulties with exporting special language characters to a flat file in a TI process. It is about hungarian characters, for example ő - no matter what I do, in the flat file I get a question mark. My best hope was this, but it made no difference:

setOutputCharacterSet (sOutfile, 'TM1CS_ISO_8859_2');

Any ideas?

Regards
Holger

Re: SetOutputCharacterSet

Posted: Wed Mar 20, 2013 4:09 pm
by jim wood
Have you tried TM1CS_ISO_8859_16?

Re: SetOutputCharacterSet

Posted: Wed Mar 20, 2013 4:46 pm
by Duncan P
Which are you using, ASCIIOutput or TextOutput?

[EDIT]
The other thing to consider is this from the TM1 Docs
This argument should be indentical to the FileName argument for the TextOutput function.

Re: SetOutputCharacterSet

Posted: Fri Mar 22, 2013 8:52 am
by holger_b
Sorry no difference, not with the codepage Jim proposed, nor using textoutput instead of asciioutput. And I made sure the filename variable is complete including path and extension...

Re: SetOutputCharacterSet

Posted: Fri Mar 22, 2013 9:17 am
by Duncan P
Just to be clear ASCIIOutput only uses the ASCII character set - like it says on the tin. If you want anything other than US ASCII then use TextOutput.

Two option spring to mind.
  1. Use TM1CS_UTF8 (which I thought was the default) and which should provide a readable file
  2. Find out what your Windows code page is and use TM1CS_WCPnnnn where nnnn is your code page

Re: SetOutputCharacterSet

Posted: Fri Mar 22, 2013 9:27 am
by .pk.
I always use TM1CS_UTF8, works like a charm with windows editors.

Re: SetOutputCharacterSet

Posted: Mon Mar 25, 2013 2:54 pm
by holger_b
Finally it worked after I decided to move the setOutputCharacterSet function from the prolog to the data tab where the file is actually written. Apparently one must keep in mind that each tab writes a new file (or overwrites the one from the previous tab), so you need to have the code page definition there.

Thanks for your help!

Holger

Re: SetOutputCharacterSet

Posted: Thu Jul 16, 2020 10:44 am
by fr4n3kj
holger_b wrote: Mon Mar 25, 2013 2:54 pm Finally it worked after I decided to move the setOutputCharacterSet function from the prolog to the data tab where the file is actually written. Apparently one must keep in mind that each tab writes a new file (or overwrites the one from the previous tab), so you need to have the code page definition there.

Thanks for your help!

Holger
Thanks for the solution! I had the same problem with setOutputCharacterSet and was trying to find what is wrong and which encoding should I use. In the end it was good encoding but bad placing.

It's interesting difference between setOutputCharacterSet and for example DatasourceASCIIDelimiter, which I didn't see earlier but which is kinda obvious. The first one is referring to "DataSource" and it can be applied once in the prolog and the second one is applied to output data (TextOutput) but only (as You pointed out) in one tab, because (from IBM):
The text file is opened when the first record is written, and is closed when the TurboIntegrator procedure (Prolog, Metadata, Data, or Epilog) containing the TextOutput function finishes processing.