Skip to content

Instantly share code, notes, and snippets.

@phillipadsmith
Created May 11, 2009 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phillipadsmith/110156 to your computer and use it in GitHub Desktop.
Save phillipadsmith/110156 to your computer and use it in GitHub Desktop.
<?xml version="1.0" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.bricolage.cc/bugzilla.dtd">
<bugzilla version="3.0"
urlbase="http://bugs.bricolage.cc/"
maintainer="marshall@exclupen.com"
exporter="phillip@communitybandwidth.ca"
>
<bug>
<bug_id>802</bug_id>
<creation_ts>2004-09-07 19:17</creation_ts>
<short_desc>Set SvUTF8_on on Data Fetched from Database</short_desc>
<delta_ts>2004-09-10 23:10:47</delta_ts>
<product>Bricolage</product>
<bug_status>ASSIGNED</bug_status>
<priority>P2</priority>
<bug_severity>enhancement</bug_severity>
<target_milestone>1.8.3</target_milestone>
<everconfirmed>1</everconfirmed>
<reporter name="David Wheeler">david@kineticode.com</reporter>
<assigned_to name="David Wheeler">david@kineticode.com</assigned_to>
<long_desc isprivate="0">
<who name="David Wheeler">david@kineticode.com</who>
<bug_when>2004-09-07 19:17:14</bug_when>
<thetext>Once a new version of DBI comes out with the necessary UTF-8 tools, use
$dbh-&gt;{SetUTF8} = 2;
To make all of our character issues go away.
References:
http://bugs.bricolage.cc/show_bug.cgi?id=709#c14
http://www.mail-archive.com/dbi-dev@perl.org/msg03451.html</thetext>
</long_desc>
<long_desc isprivate="0">
<who name="David Wheeler">david@kineticode.com</who>
<bug_when>2004-09-09 14:32:51</bug_when>
<thetext>Created an attachment (id=135)
Interim Solution
This is an interim solution using DBD::Pg&apos;s &quot;pg_enable_utf8&quot; attribute. This
should turn on the utf-8 flag for all data fetched from the database, thus
allowing substr() and friends to work properly. I&apos;d like to get rid of it and
use the DBI solution once it&apos;s in DBI. I&apos;m hoping that Tim can get it in for
1.44.</thetext>
</long_desc>
<long_desc isprivate="0">
<who name="David Wheeler">david@kineticode.com</who>
<bug_when>2004-09-10 03:08:35</bug_when>
<thetext>It turns out that the attached patch wasn&apos;t enough of an interim solution.
With the fix for Bug # 648 committed, other things started to go haywire.
It seems that Perl doesn&apos;t like to concatenate variables with their UTF-8
flag with others without their UTF-8 flag set. So we were left with two
choices:
1. Turn off UTF-8 in the data submitted from the browser (the original fix
for Bug # 648) and then eliminate all uses of substr().
2. Turn on the UTF-8 flag everywhere so that one is always concatenating
UTF-8 to UTF-8 and Perl is happy.
The second option turned out to be the only real option, although I did try
for a while to do the first. It just wasn&apos;t practical. In turning on utf8
everywhere, though, I had to do quite a bit of experimentation to get it
right. Thanks to gugod for his help in testing!
I&apos;m going to keep this bug report open as an enhancement for now, however,
because I still want to switch to using DBI instead of DBD::Pg for setting
the UTF-8 flag on all data pulled from the database, just as soon as Tim is
able to add it and get a release out.</thetext>
</long_desc>
</bug>
</bugzilla>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment