|
|
Choosing A Webhost: |
Re: APR::Table lost UTF8 flag: msg#00250apache.mod-perl.devel
Boris Zentner wrote:
In this email I'm not talking about libapreq which uses a sub-class of APR::Table. To start with: APR::Table stores plain strings, it has no way to store metadata. You need to use pnotes to store perl variables (which will preserve any of the flags). It's possible that if APR::Table sees a UTF8 flag on set(), it should encode it back to the utf8 string before storing it, since as you've pointed out there is no way to restore the UTF8 flag back. But also as you've pointed out, it's a huge waste of resources. since you will need to decoded it again, when you get() it and before you can use it. May be expicitly setting the utf8 flag will work as a temp solution for you? If all your data is stored in utf8, then it will perfectly fine. Below is the revision of your test program, that does what you want. (If you didn't know, you can use APR:: classes outside of Apache, so you can run this program from the command line): use Apache2; use APR::Table; use Encode; use APR::Pool; use Devel::Peek; my $p = APR::Pool->new; my $t = APR::Table::make($p, 10 ); my $str = "\x{f6}\x{e4}\x{fc}"; my $utf8 = Encode::decode( 'iso-8859-1', $str ); $t->set( aa => $str ); $t->set( bb => $utf8 ); my $aa = $t->get('aa'); my $bb = $t->get('bb'); Encode::_utf8_on($bb); Dump $str; Dump $utf8; Dump $aa; Dump $bb; print "is $str eq $utf8 ? ", ( $str eq $utf8 ? "yes" : "no" ), "\n", "is $utf8 eq $bb ? ", ( $utf8 eq $bb ? "yes" : "no" ), "\n"; -- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:stas@xxxxxxxxxx http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [mp2] bug in PerlPassEnv, Stas Bekman |
|---|---|
| Next by Date: | Re: t/SMOKE points the finger at filter/out_bbs_filebucket.t, Stas Bekman |
| Previous by Thread: | Re: APR::Table lost UTF8 flag, Boris Zentner |
| Next by Thread: | Re: APR::Table lost UTF8 flag, Boris Zentner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |