Remove the -Mutf8 and it'll work with a UTF-8 file. I had some issues converting a test file to UTF-16.<br><br clear="all">Vinny<br><a href="http://cronblocks.com" target="_blank">http://cronblocks.com</a><br>
<br><br><div class="gmail_quote">On Tue, May 8, 2012 at 4:27 PM, Antonio Sun <span dir="ltr"><<a href="mailto:antoniosun@lavabit.com" target="_blank">antoniosun@lavabit.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks everyone for your replies.<br><br>Yeah, I realized that the file is utf-16 afterward.<div class="im"><div><br><div class="gmail_quote">On Tue, May 8, 2012 at 3:27 PM, Vinny Alves <span dir="ltr"><<a href="mailto:vinny@usestrict.net" target="_blank">vinny@usestrict.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>perl -e 'binmode(STDIN,":encoding(UTF-8)"); while(<>){ <b style="font-family:'Times New Roman';font-size:medium"><span style="font-size:13px;font-family:Arial;color:rgb(34,34,34);font-weight:normal;vertical-align:baseline;white-space:pre-wrap">s/</span></b><s:Body><b style="font-family:'Times New Roman';font-size:medium"><span style="font-size:13px;font-family:Arial;color:rgb(34,34,34);font-weight:normal;vertical-align:baseline;white-space:pre-wrap">/</span></b><s:Body xmlns:a=..
<div>.><b style="font-family:'Times New Roman';font-size:medium"><span style="font-size:13px;font-family:Arial;color:rgb(34,34,34);font-weight:normal;vertical-align:baseline;white-space:pre-wrap">/</span></b><b> </b>}' < myfile.utf8<br>
</div></div></blockquote></div><br></div></div><div>Thanks, that's exactly what I was looking for. </div><div>However, I tried the following and it doesn't work. </div><div><br></div><div><div>$ perl -Mutf8 -pe 'binmode(STDIN,":encoding(UTF-16)"); s/<s:Envelope/<s:Envelope xmlns:a=...>/' < myfile.utf8 > myfile.out </div>
<div><br></div><div>$ cmp myfile.utf8 myfile.out && echo same </div><div>same</div></div><div><br></div><div>Seems that the replace strings ('s:Envelope...') are not handled as wide chars in Perl. </div><div>
<br></div><div><br></div>
</blockquote></div><br>