The "g" _should_ do it. Quite puzzling.<br>Can you do a run and find an example of when it fails? Is it always 0xbd?<br><br>Maybe someone in Tibet doesn't like your code :-) (It's a Tibetan character code in utf8)<br>
<br><div class="gmail_quote">On Thu, Mar 31, 2011 at 2:59 PM, Geoffrey Myers <span dir="ltr"><<a href="mailto:lists@serioustechnology.com">lists@serioustechnology.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">Jim Kinney wrote:<br>
> should it be replaced with nothing or with a NULL? Does the perl pointer<br>
> jump to the next character automatically when a match is made thus<br>
> skipping a character in your replace? Does a double run fix it?<br>
<br>
</div>Missed the first question. It should be removed, not replaced with an<br>
null. For example I have:<br>
<br>
This is my <UGLY CHARACTER>data<br>
<br>
Should then be:<br>
<br>
This is my data<br>
<div class="im"><br>
><br>
> On Thu, Mar 31, 2011 at 12:04 PM, Geoffrey Myers<br>
</div><div class="im">> <<a href="mailto:lists@serioustechnology.com">lists@serioustechnology.com</a> <mailto:<a href="mailto:lists@serioustechnology.com">lists@serioustechnology.com</a>>> wrote:<br>
><br>
> So, we are trying to convert a number of postgresql databases that were<br>
> created with SQL_ASCII encoding to UTF8 encoding. As such, I need to<br>
> strip certain characters out of the data before dumping and reloading<br>
> the new databases. I'm using the following:<br>
><br>
> data =~ s/(.)/((ord($1) >= 0) && (ord($1) <= 8))<br>
> || (ord($1) == 11)<br>
> || ((ord($1) >= 13) && (ord($1) <= 31))<br>
> || ((ord($1) >= 127)) ?"": $1/egs;<br>
><br>
> Yet I'm getting the following error, which indicates a character that<br>
> should be handled by the above code is still in the data:<br>
><br>
> pg_restore: [archiver (db)] COPY failed: ERROR: invalid byte sequence<br>
> for encoding "UTF8": 0xbd<br>
><br>
><br>
> Certainly, the above code should replace the 0xbd with nothing?<br>
><br>
> Any perl/postgres gurus out there?<br>
><br>
> --<br>
> Until later, Geoffrey<br>
><br>
> "I predict future happiness for America if they can prevent<br>
> the government from wasting the labors of the people under<br>
> the pretense of taking care of them."<br>
> - Thomas Jefferson<br>
> _______________________________________________<br>
> Ale mailing list<br>
</div>> <a href="mailto:Ale@ale.org">Ale@ale.org</a> <mailto:<a href="mailto:Ale@ale.org">Ale@ale.org</a>><br>
<div class="im">> <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
> <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
><br>
><br>
><br>
><br>
> --<br>
> --<br>
> James P. Kinney III<br>
> I would rather stumble along in freedom than walk effortlessly in chains.<br>
><br>
><br>
><br>
</div>> ------------------------------------------------------------------------<br>
<div><div></div><div class="h5">><br>
> _______________________________________________<br>
> Ale mailing list<br>
> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
> <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
> <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br>
<br>
--<br>
Until later, Geoffrey<br>
<br>
"I predict future happiness for America if they can prevent<br>
the government from wasting the labors of the people under<br>
the pretense of taking care of them."<br>
- Thomas Jefferson<br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-- <br>James P. Kinney III<br>I would rather stumble along in freedom than walk effortlessly in chains.<br><br><br>