logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

Re: APR::Table lost UTF8 flag: msg#00264

apache.mod-perl.devel

Subject: Re: APR::Table lost UTF8 flag

Boris Zentner wrote:
[...]

So you suggest that APR::Table should always look at the perl variable before it stores it, and store the PV string as is if UTF8 flag is not set, otherwise encoded it into a utf8 string and only then store it. That way no data will ever get corrupted.

On return it should always return a PV with the utf8 string, w/o setting UTF8 flag (and doing any further conversion). A user that will want to do the conversion will do that on their own.

In other words (using the Dump entries from your original example), if APR::Table gets:

SV = PV(0x1a48774) at 0x1a5b7a4
REFCNT = 1
FLAGS = (PADBUSY,PADMY,POK,pPOK)
PV = 0x2b67550 "\366\344\374"\0
CUR = 3
LEN = 4

it stores "\366\344\374"\0 as is. If it gets:

SV = PVMG(0x1b17300) at 0x1a48afc
REFCNT = 1
FLAGS = (PADBUSY,PADMY,POK,pPOK,UTF8)
IV = 0
NV = 0
PV = 0x2b67cc0 "\303\266\303\244\303\274"\0 [UTF8 "\x{f6}\x{e4}\x{fc}"]
CUR = 6
LEN = 7
MAGIC = 0x2b67310
MG_VIRTUAL = &PL_vtbl_utf8
MG_TYPE = PERL_MAGIC_utf8(w)
MG_LEN = 3

it decodes "\303\266\303\244\303\274"\0 into "\366\344\374"\0 and stores the latter.

When APR::Table gives back the perl variable it should always return it as:

SV = PV(0x1acd900) at 0x1a5d484
REFCNT = 1
FLAGS = (PADBUSY,PADMY,POK,pPOK)
PV = 0x2b671d0 "\366\344\374"\0
CUR = 3
LEN = 4

Is that correct? I think we could do that.

Care to send a patch to the code, tests and docs? But may be wait a bit starting to work on that, in case someone objects to that change. First, I just wanted to know if you are willing to work on that ;)

What I'm not sure about is that whether this is the only place, where this kind of transformation needs to be done. I'm pretty sure that we have quite a few other APIs that grab the PV slot passing it to APR/Apache, regardless of the state of the UTF8 flag.

--
__________________________________________________________________
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>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive 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

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo