Whoops, "fix" is actually supposed to be "sub fix". Silly me.<br><br><div><span class="gmail_quote">On 10/5/06, <b class="gmail_sendername">Adam Paynter</b> <<a href="mailto:adampaynter@gmail.com">adampaynter@gmail.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Howdy,<br><br>We have run into many nightmares at our organization with regards to this. We also use PostgreSQL 8. Although there are other ways of solving the problem, I typically do something as follows:
<br><br><span style="font-family: courier new,monospace; color: rgb(0, 153, 0);">
use Encode qw( _utf8_off _utf8_on from_to );</span><br style="font-family: courier new,monospace; color: rgb(0, 153, 0);"><br style="font-family: courier new,monospace; color: rgb(0, 153, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 153, 0);">
fix {</span><br style="font-family: courier new,monospace; color: rgb(0, 153, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 153, 0);"> my $s = shift;</span><br style="font-family: courier new,monospace; color: rgb(0, 153, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 153, 0);"> return undef unless defined $s;</span><br style="font-family: courier new,monospace; color: rgb(0, 153, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 153, 0);">
_utf8_off( $s );</span><br style="font-family: courier new,monospace; color: rgb(0, 153, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 153, 0);"> from_to( $s, 'cp1250', 'utf8' );</span><br style="font-family: courier new,monospace; color: rgb(0, 153, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 153, 0);"> _utf8_on( $s );</span><br style="font-family: courier new,monospace; color: rgb(0, 153, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 153, 0);">
return $s;</span><br style="font-family: courier new,monospace; color: rgb(0, 153, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 153, 0);">}</span><br style="font-family: courier new,monospace; color: rgb(0, 153, 0);">
<br style="font-family: courier new,monospace; color: rgb(0, 153, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 153, 0);">my $nice_string = fix( $ugly_string );</span><br><br>Perhaps this will help!
<br><span class="sg">
<br>- Adam</span><div><span class="e" id="q_10e181f94975ff0e_2"><br><br><div><span class="gmail_quote">On 10/4/06, <b class="gmail_sendername">John Napiorkowski</b> <<a href="mailto:jjn1056@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
jjn1056@yahoo.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Okay,<br><br>Sorry this had nothing to do with utf8, but some data<br>that was formated in CHARSET=windows-1252, that crazy<br>windows only format.<br><br>I found a modules called, "Encode::ZapCP1252" but that<br>
didn't seem to help me. It actually seemed to just<br>delete all the values it received without changing<br>anything.<br><br>I could run a regex to clean this out but that's<br>really ugly.<br><br>Has anyone run into that and found a more elegant
<br>solution (besides yelling at the people sending me<br>windows only data?)?<br><br>Thanks!<br><br>John Napiorkowski<br><br>--- John Napiorkowski <<a href="mailto:jjn1056@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
jjn1056@yahoo.com</a>> wrote:<br>
<br>> Hi,<br>><br>> I'm having trouble inserting data that has some utf8<br>> characters mixed in. I am using a postgres 8.1x<br>> database and the database was created with utf8<br>> option.<br>><br>
> The error I get is:<br>><br>> INSERT INTO ... execute failed: ERROR invalid byte<br>> sequence for encoding "UTF8".<br>><br>> The value it's failing on is "Bj�rn Stabell".<br>><br>
> I looked at the DBIx::Class::UTF8Columns component<br>> but<br>> I wasn't sure how that could help me or if it could<br>> help me.<br>><br>> I'm running this under Catalyst and thought I was<br>> doing utf8 correctly, based on the (unfortunately
<br>> few)<br>> examples I could find.<br>><br>> I'm sure this is something simple I should do but<br>> google is not being kind to my inquiries. How have<br>> the rest of you been dealing with this?<br>
><br>> Thanks!<br>> John Napiorkowski<br>><br>> __________________________________________________<br>> Do You Yahoo!?<br>> Tired of spam? Yahoo! Mail has the best spam<br>> protection around<br>
>
<a href="http://mail.yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mail.yahoo.com</a><br>><br>> _______________________________________________<br>> List:<br>><br><a href="http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
</a><br>> Wiki: <a href="http://dbix-class.shadowcatsystems.co.uk/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://dbix-class.shadowcatsystems.co.uk/</a><br>> IRC: irc.perl.org#dbix-class
<br>> SVN:<br>><br><a href="http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/</a><br>> Searchable Archive:<br>><br><a href="http://www.mail-archive.com/dbix-class@lists.rawmode.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.mail-archive.com/dbix-class@lists.rawmode.org/
</a><br>><br><br><br>__________________________________________________<br>Do You Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection around<br><a href="http://mail.yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://mail.yahoo.com</a><br>
<br>_______________________________________________<br>List: <a href="http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
</a><br>Wiki: <a href="http://dbix-class.shadowcatsystems.co.uk/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://dbix-class.shadowcatsystems.co.uk/</a><br>IRC: irc.perl.org#dbix-class<br>SVN: <a href="http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/</a><br>Searchable Archive:
<a href="http://www.mail-archive.com/dbix-class@lists.rawmode.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.mail-archive.com/dbix-class@lists.rawmode.org/</a><br></blockquote></div>
<br>
</span></div></blockquote></div><br>