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:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]