A. Pagaltzis wrote:

* Linda W <[EMAIL PROTECTED]> [2005-03-02 01:20]:

As it is, TieRegistry certainly seems to have problems
reliably accessing values under keynames where the keynames
are not ascii strings. [...] something in the registry export
feature doesn't quite translate the keynames the same under
UCS-16 v. UTF-8.  :-(

Surely that's simply a bug and doesn't warrant wholesale deprecation of TieRegistry? Sounds like someone isn't doing the required work of making Perl understand the Unicode-ness of the strings. The module you want to look into is not utf8 (which doesn't do much), it's Encode, and in your particular case probably Encode::Unicode.

If you are attempting to fix the module yourself and you don't
know much about encodings, be sure to read "The Absolute Minimum
Every Software Developer Absolutely, Positively Must Know About
Unicode and Character Sets (No Excuses!)"[1].

[1] http://www.joelonsoftware.com/articles/Unicode.html


It may be a bug, but I'm not certainly not the best person to try to fix it.

Problem is that the keys have binary names that may or
may not be valid UTF/Unicode characters. As near as I
can tell, there is no requirement on key or value _names_
other than that they cannot contain a "\".


It would seem binary garbage is 'ok' for a keyname.  I
don't know how perl can "string-ify" such garbage -- especially
if you look at the above two text files in Gvim -- one of
the keynames doesn't even map to the same displayable
characters which indicates it might be an invalid unicode
character.  I'm not sure what perl does with invalid
character data in a variable when you try to manipulate
it by appending it to another value.

>>>It could be a bug in perl.<<<

I'm using the returned member names from indexing a key
as hash-keys into sub-keys or sub-values.  In this specific
case, they are sub-keynames that are binary.  To look up
such a key, one must append a backslash to it "\\".

Thus the code snippet:

print_key($cur_key->{"$keyname\\"}, "$keyname",$level+1);

Where it recursively calls the print_key routine to lookup
subkeys/values.  It does have 1 value under the keyname
(the default value).  I can manipulate the key using regedit,
but not, seemingly, in perl via TieRegistry.  I'm not sure
if the fault is in TieRegistry or perl.

If you are on a Win platform, you should be able to change
one of the above txt files to extension, .reg, and import
it, but I can't guarantee that they will both import the same.
That'd be a separate experiment...:-) (*sigh*)

Xposting to porter's list as it may require some insight
into how perl handles such odd cases and may be a perl 5.8.6
bug.  If anyone on the perl5-porters list wants to see the code
snippet, I can post that as well, it's fairly simplistic/small
(~1K).  I was using it as a "test" program to see if I could
iterate my registry with TieRegistry under perl and if perl
could be used, reliably, to manipulate the registry.

It enumerated my "Classes" key, but quickly failed on the
"CUser" key because of these weird keynames.

Linda




REGEDIT4

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\Curren0]
@="Audio\\VoyTheme\\STBeep1.wav"

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\current0?]
@="Audio\\VoyTheme\\STBeep1.wav"

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\current0?]
@="Audio\\VoyTheme\\STBeep1.wav"

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\AppGPFault\Curren0]
@="Audio\\Computer\\Computer error.wav"

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\AppGPFault\current0?]
@="Audio\\Computer\\Computer error.wav"

ÿþWindows Registry Editor Version 5.00



[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\Curren0]

[EMAIL PROTECTED]"Audio\\VoyTheme\\STBeep1.wav"



[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\current0?]

[EMAIL PROTECTED]"Audio\\VoyTheme\\STBeep1.wav"



[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\current0¼€]

[EMAIL PROTECTED]"Audio\\VoyTheme\\STBeep1.wav"



[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\AppGPFault\Curren0]

[EMAIL PROTECTED]"Audio\\Computer\\Computer 
error.wav"



[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\AppGPFault\current0¼€]

[EMAIL PROTECTED]"Audio\\Computer\\Computer 
error.wav"



Reply via email to