Write into Text File needs a 'no BOM' option

Got a problem you cannot solve? Try here.
JohnO
Posts: 127
Joined: Tue Jun 18, 2013 9:52 am

Write into Text File needs a 'no BOM' option

Postby JohnO » Mon Nov 25, 2013 7:33 am

I am using 'Write into Text File' to write out some installer values to a 'config.properties' file, which consist of pairs of 'key=value'. When reading this file in our Java application, I was getting null returned for one of the keys. After about half a day of investigation, I discovered this was because IA had written out the UTF-8 file with the optional Byte Order Mark (BOM).

I then spent the other half of the day trying to come up with some clever way of ignoring the BOM, until the obvious, simple solution occurred to me - write out the first line of config.properties as a comment (# This is a comment).

I really think the Write to Text File should have a checkbox to control the writing of the BOM.

Incidentally, if anyone tries this, DO NOT code the value as "# This is a comment". When you build the installer, it fails with a weird message to do with this statement, but at a different line number. Basically, it thinks that "# This is a comment" is a compiler variable with a missing '#'! But, the build seemed to hang on to this, even after I changed the code. I had to revert my script from subversion to get it working.

What you have to do is to define a compiler variable to hold the comment, e.g: #COMMENT# = # This is a comment

John

FrancescoT
Site Admin
Posts: 4856
Joined: Sun Aug 22, 2010 4:28 am

Re: Write into Text File needs a 'no BOM' option

Postby FrancescoT » Mon Nov 25, 2013 1:11 pm

Dear John,

thank you for sharing your findings ... but anyway, I suppose that even adding an empty string is enough.

Regards
Francesco Toscano
InstallAware Software Support

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

bengtbr
Posts: 2
Joined: Tue Sep 25, 2012 1:59 am

Re: Write into Text File needs a 'no BOM' option

Postby bengtbr » Wed Dec 18, 2013 3:31 am

In my own tests InstallAware 18 will store the UTF BOM bytes to the beginning of the text file when using the "Write into text file" command.
This also even if you have an original ANSI text file to which you append text with "write into text file". The file will change to UTF-8 after the command.
Writing a newline or comment string to the beginning of the text file doesn't help as mentioned in some postings.
Our problem was related to reading a configuration file produced by IA and in this case we have now to change the application reading the configuration file.
The BOM option would indeed have been nice in this case.
Best regards
Bengt Bredenberg

FrancescoT
Site Admin
Posts: 4856
Joined: Sun Aug 22, 2010 4:28 am

Re: Write into Text File needs a 'no BOM' option

Postby FrancescoT » Wed Dec 18, 2013 12:21 pm

Dera Bengt,

In fact, the suggestion was intended to be used when writing to a file ... am I missing something?

Regards
Francesco Toscano
InstallAware Software Support

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

bengtbr
Posts: 2
Joined: Tue Sep 25, 2012 1:59 am

Re: Write into Text File needs a 'no BOM' option

Postby bengtbr » Thu Dec 19, 2013 12:18 am

Hi Francesco
My problem was and still is that when writing text to a file using "write into text file" IA
will always add the BOM characters to the beginning of the file and at the same time make the file
an UTF-file. It will also do it if I only write a $newline$ to the file. Does your comment suggest there is
another way to write text to a file than using the command "write into text file".
Bengt

FrancescoT
Site Admin
Posts: 4856
Joined: Sun Aug 22, 2010 4:28 am

Re: Write into Text File needs a 'no BOM' option

Postby FrancescoT » Thu Dec 19, 2013 12:43 pm

Dear Bengt,

please excuse me, but I am not sure to follow your reply ...

... are you asking if exist another way to write to a text file with IA?

If true, it is not.

Regards
Francesco Toscano
InstallAware Software Support

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

JohnO
Posts: 127
Joined: Tue Jun 18, 2013 9:52 am

Re: Write into Text File needs a 'no BOM' option

Postby JohnO » Mon Jan 06, 2014 10:30 am

Dear Francesco
I have now seen the same issue as bengtbr. Writing some values to an existing ascii file that is part of our app - it gets changed to UTF-8, and has the three BOM characters at the start. As my file is a Java properties file, I can work round it by making line 1 into a comment. This will not work for some files.

What IA needs is for Write-into-Text-File to have an option that controls whether the BOM should be written or not. IA introduced the use of UTF-8 in IA 16 (I think), before that, this file would have been ascii. To me it is an oversight on the part of IA development team for IA16. Especially, since the UTF-8 spec says that a BOM is optional (OK, I have seen conversations that argue the finer points of this, but for practical purposes it is optional).

I think fixing this should be a matter of some urgency.

Regards, John

FrancescoT
Site Admin
Posts: 4856
Joined: Sun Aug 22, 2010 4:28 am

Re: Write into Text File needs a 'no BOM' option

Postby FrancescoT » Wed Jan 08, 2014 12:03 pm

Dear John,

it is not a question of fixing it but eventually, to have this option with future IA versions.
By now, I can only post a note about to our dev team.

Regards
Francesco Toscano
InstallAware Software Support

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

JohnO
Posts: 127
Joined: Tue Jun 18, 2013 9:52 am

Re: Write into Text File needs a 'no BOM' option

Postby JohnO » Wed Jan 15, 2014 7:58 am

Dear Francesco
A note to your dev team is the right answer! Thanks for doing that. I hope you were able to emphasise it's urgency. Though l do understand that what looks like a small change (adding a checkbox) can be just the tip of an iceberg.

Regards, John

JeffryPaul
Posts: 50
Joined: Fri Mar 02, 2007 6:56 pm

Re: Write into Text File needs a 'no BOM' option

Postby JeffryPaul » Tue Mar 25, 2014 9:54 am

This is a serious oversight for the IA developers. When writing to new text file, there must be a way to distinguish whether the file will be UTF or ANSI format.
Is this still a problem as of version 18.05? The Installaware Blog does not indicate that the problem has been resolved.
Until this is resolved, I cannot upgrade to version 18.x.

FrancescoT
Site Admin
Posts: 4856
Joined: Sun Aug 22, 2010 4:28 am

Re: Write into Text File needs a 'no BOM' option

Postby FrancescoT » Tue Mar 25, 2014 1:10 pm

Dear Jeffry,

Currently, the "write to text file" command only stores data using the UTF format.

As I have already said previously; it is not a question of fixing it, but instead, to have this option with future IA versions.

regards
Francesco Toscano
InstallAware Software Support

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

cancelor
Posts: 16
Joined: Mon Oct 22, 2007 4:22 pm

Re: Write into Text File needs a 'no BOM' option

Postby cancelor » Sun Oct 04, 2015 6:32 am

I've been falling in this problem as well, as soon as I've updated to IA X2. Yes, IT IS A BUG. IA CORRUPTS an ANSI file by writing a BOM. Currently my installation program creates problems to user and I need to write to the file without using IA.

FrancescoT
Site Admin
Posts: 4856
Joined: Sun Aug 22, 2010 4:28 am

Re: Write into Text File needs a 'no BOM' option

Postby FrancescoT » Mon Oct 05, 2015 10:36 am

IT'S NOT A BUG!

latest InstallaAware version only writes UNICODE UTF8 files ... which are not ANSI.
Francesco Toscano
InstallAware Software Support

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

pfennig
Posts: 97
Joined: Wed Nov 08, 2006 8:39 am

Re: Write into Text File needs a 'no BOM' option

Postby pfennig » Mon Nov 14, 2016 3:51 am

FrancescoT wrote:Currently, the "write to text file" command only stores data using the UTF format.

As I have already said previously; it is not a question of fixing it, but instead, to have this option with future IA versions.


Several versions later this option is still not implemented. Files are still be written as UTF8 with BOM.
Since we had to do respective changes in our program code as well, I know that this part isn't a big deal.
Please, could you remind your development team to implement this feature really soon?
Best regards
pfennig

FrancescoT
Site Admin
Posts: 4856
Joined: Sun Aug 22, 2010 4:28 am

Re: Write into Text File needs a 'no BOM' option

Postby FrancescoT » Wed Nov 16, 2016 12:56 pm

Dear Pfennig,

unfortunately, I don't believe it will be implemented in future IA versions.

Regards
Francesco Toscano
InstallAware Software Support

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 14 guests