Page 1 of 1

FormBuilder: Saving flat-file in ANSI?

Posted: Wed Dec 30, 2009 7:23 am
by superstoffe
Is it possible to control how the flat-file function saves the file, and what encoding it should use? Or is that server based of some sort?

I've got a request to get files in ANSI, to be able to import them into a business system. Would be awesome to get it to work.

Re: FormBuilder: Saving flat-file in ANSI?

Posted: Wed Dec 30, 2009 8:53 am
by Peciura
I've got a request to get files in ANSI
Do you mean "ASCII" ?
ASCII is subset of UTF-8 (variable byte length encoding). If you don't have any special characters (e.g. English only) your document is encoded in both ASCII and UTF-8. To avoid unexpected behavior you might want to use function "htmlspecialchars".

Re: FormBuilder: Saving flat-file in ANSI?

Posted: Wed Dec 30, 2009 10:07 am
by scooper
They probably do mean ANSI - it's an old Windows character set http://en.wikipedia.org/wiki/Windows-1252  - I seem to remember it's the default if you save text files from Notepad.

Anyway - it's probably going to be a bit of trial and error but should be doable.

You could try and set the character set in Form Builder (not great if you want to upgrade), or you could write a tag that converted the file to the right character set.

Take a look at iconv http://www.php.net/manual/en/function.iconv.php and iconv_set_encoding http://www.php.net/manual/en/function.iconv-set-encoding.php as a start.

Or of course tell your business system people to get into the 21st Century and move to UTF-8.

s.

EXCEL dont read UTF8 files only ANSI files

Posted: Sun Jan 31, 2010 11:05 am
by mr_to
hi everybody  
i have the same problem
all my servers are in UFT8, everythings ok
BUT with formbuilder
when i write the posted data on a flat file csv for excel
this one don't know  what is UTF8
he read only ANSI encoding

I look for a solution to write data ANSI encodedin the flat file

if anyone have a hack of code or a simple solution
regards
MR TO

ok here is my solution

creat a "utf_8_decode" user tag

if( isset( $params['datatoconvert'] ) )
{
echo (utf8_decode ($params['datatoconvert']));
}

in the Template for one line of output file (in the field write to flat file)

use the Variables For Template aliases as params

{utf_8_decode datatoconvert=$fld_30 };{utf_8_decode datatoconvert=$fld_31 };{utf_8_decode datatoconvert=$fld_32 }

with all the fields you need

hope this can help someone again

Regards
TO

Re: FormBuilder: Saving flat-file in ANSI?

Posted: Fri Jun 08, 2012 7:09 am
by yurayurayura