| Store | Cart

Re: How to append BOM at the beginning of a binary

From: Francesco Nidito <fran...@gmail.com>
Tue, 9 Jun 2015 16:55:03 +0100
My bad... it should have been "FEFF" instead of "FFEF" (why the h**l did I
write that reverse?)


 ------------------------------
«With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly overhead.»
— R. Callon (rfc1925)

On 9 June 2015 at 15:26, Nagy Tamas (TVI-GmbH) <tama...@tvi-gmbh.de>
wrote:

>  Hi,>>>> I tried:>> perl -CO -ne "BEGIN{print qq{\x{BBBF}}}; print" in.xml > out.xml>>>> but it writes: EB AE BF to the beginning, so there is an AE in it, but why?>> So it prepends to the proper place but not the proper characters.>>>> perl -CO -ne "BEGIN{print qq{\x{EB}}}; print" out.xml > out2.xml>>>> i did not run the last one, because former prepended characters are wrong.>>>> Tamas Nagy>>>> *Von:* Francesco Nidito [mailto:fran...@gmail.com]> *Gesendet:* Dienstag, 9. Juni 2015 09:58> *An:* Nagy Tamas (TVI-GmbH)> *Cc:* perl...@listserv.ActiveState.com> *Betreff:* Re: How to append BOM at the beginning of a binary>>>> Try: perl -CO -ne "BEGIN{print qq{\x{FFEF}}}; print" in.xml > out.xml>>>>  ------------------------------>> «With sufficient thrust, pigs fly just fine. However, this is not> necessarily a good idea. It is hard to be sure where they are going to> land, and it could be dangerous sitting under them as they fly overhead.»> — R. Callon (rfc1925)>>>> On 9 June 2015 at 08:11, Nagy Tamas (TVI-GmbH) <tama...@tvi-gmbh.de>> wrote:>> Hi,>> All the 3 gives the error in Windows CMD:>> "Can't do inplace edit without backup.">> Tamas Nagy>>> On 6/8/15 10:48 AM, Nagy Tamas (TVI-GmbH) wrote:> > Hi,> >> > perl -p -i -e 'BEGIN { printf "%c%c%c", 0xEF, 0xBB, 0xBF }'> > default.xml perl -p -i -e 'BEGIN { print pack "c3", 0xEF, 0xBB, 0xBF> > }' default.xml> >> > Both give the same error:> >> > Can't find string terminator "'" anywhere before EOF at -e line 1.> >> > Is it because of Windows CMD? How to get it work?>> Yeah, that's probably due to the peculiar command line parsing in> Windows.  I happen to be on a Mac, but its shell is the same as the shell> on Linux.>> I don't have a Windows machine to test it on, but I think that it wants> double quotes to enclose the script.  Any quotes inside the script either> have to be single quotes (if the string doesn't require variable> interpolation),>>   perl -p -i -e "BEGIN { printf '%c%c%c', 0xEF, 0xBB, 0xBF }" default.xml>> or escaped double quotes,>>   perl -p -i -e "BEGIN { printf \"%c%c%c\", 0xEF, 0xBB, 0xBF }" default.xml>> or use a quoting operator,>>   perl -p -i -e "BEGIN { printf qq{%c%c%c}, 0xEF, 0xBB, 0xBF }" default.xml>>> That would apply to any Perl one-liner you try to run on Windows.> Most Perl one-liner examples that you are likely to find on the web assume> a Unix-like shell.>> I know all that is a digression from your XML problem, but a solution to> that problem might be expressible as a one-liner, also, so it's important> to get past this minor obstacle.>> Why do you think you need to put a BOM on your XML file?>> --> David Thomas> Sugar Land, Texas> _______________________________________________> Perl-XML mailing list> Perl...@listserv.ActiveState.com> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs> _______________________________________________> Perl-XML mailing list> Perl...@listserv.ActiveState.com> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs>>>> _______________________________________________> Perl-XML mailing list> Perl...@listserv.ActiveState.com> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs>>

_______________________________________________
Perl-XML mailing list
Perl...@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Recent Messages in this Thread
Nagy Tamas (TVI-GmbH) Jun 08, 2015 03:48 pm
David Thomas Jun 08, 2015 04:48 pm
Francesco Nidito Jun 08, 2015 05:22 pm
John Alvord Jun 08, 2015 07:25 pm
Nids Jun 08, 2015 08:34 pm
Nagy Tamas (TVI-GmbH) Jun 09, 2015 07:11 am
Francesco Nidito Jun 09, 2015 07:57 am
Nagy Tamas (TVI-GmbH) Jun 09, 2015 02:26 pm
Francesco Nidito Jun 09, 2015 03:55 pm
Messages in this thread