Win32::TieRegistry only deals with 8-bit-character strings as it uses the *A APIs not the *W APIs. Win32API::Registry exposes the *W APIs, but you'll have to do some extra work to translate the information you give and get1.
Those two registry modules were written before Perl had much of a clue about Unicode. Now that Perl has settled on UTF-8 (or something very close to UTF-8, I hear) and has some decent support for it, it'd be a good idea to update Win32::TieRegistry to take advantage of it, at least optionally.
The script you wrote dies because it (MS's *A API) translates the key name as best it can into your current 8-bit locale. That is, it translates the name into something similar but not the same. So trying to open a key by the translated name finds no match. You don't check for the open failing so when you try to use the return value you get the error you showed.
- tye
1 The *W APIs use what Microsoft calls "UNICODE", which is really fixed-width 16-bit characters somewhat like UTF-16 except, of course, for it being fixed-width. So it matches UTF-16 so long as you only use characters that can fit in 15 bits. Some will even tell you that UTF-16 is fixed-width. They are just a little confused (UTF-16 "is fixed-width" so long as you only use characters that fit within 15 bits).
If you try to use Unicode characters that require exactly 16 bits, then Microsoft's "UNICODE" will probably set the highest bit while UTF-16 would encode the character into 32 bits (I think). Unicode characters that require more than 16 bits don't fit in Microsoft's "UNICODE" format.
Microsoft also supports UTF-8 which it calls "wide character", but it mostly just lets you translate that into either ASCII or "UNICODE"; it doesn't really provide APIs that deal with it in, for example, file names or registry keys.
In reply to Re: possible perl bug or, at least, Win32::[TieRegistry|Registry] bug with difficult keynames (limitation)
by tye
in thread possible perl bug or, at least, Win32::[TieRegistry|Registry] bug with difficult keynames
by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |