I am working on a Perl program that processes a Windows Registry .reg
file and outputs it into some defined XML. I have a problem
specificially with converting REG_MULTI_SZ to readable strings
(REG_MULTI_SZ are discussed here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry_reference.asp).
From a .reg file I have something like this:
"SystemBiosVersion"=hex(7):41,00,20,00,4d,00,20,00,49,00,20,00,20,00,2d,00,20,\
00,39,00,30,00,30,00,30,00,32,00,31,00,30,00,00,00,42,00,49,00,4f,00,53,00,\
20,00,44,00,61,00,74,00,65,00,3a,00,20,00,30,00,39,00,2f,00,31,00,30,00,2f,\
00,30,00,32,00,20,00,30,00,39,00,3a,00,31,00,35,00,3a,00,31,00,32,00,20,00,\
20,00,56,00,65,00,72,00,3a,00,20,00,30,00,38,00,2e,00,30,00,30,00,2e,00,30,\
00,30,00,00,00,42,00,49,00,4f,00,53,00,20,00,44,00,61,00,74,00,65,00,3a,00,\
20,00,30,00,39,00,2f,00,31,00,30,00,2f,00,30,00,32,00,20,00,30,00,39,00,3a,\
00,31,00,35,00,3a,00,31,00,32,00,20,00,20,00,56,00,65,00,72,00,3a,00,20,00,\
30,00,38,00,2e,00,30,00,30,00,2e,00,30,00,30,00,00,00,00,00
I can strip out the commas and backslashes and make one long hex
string. It should decode to a string that looks something like this
(regedit can be a little buggy sometimes):
"A M I - 9000210\0BIOS Date: 09/10/02 09:15:12 Ver: 08.00.00\0BIOS
Date: 09/10/02 09:15:12 Ver: 08.00.00\0\0"
So I have 3 strings and each one ends with a null terminator and the
entire string ends with an extra null terminator.
The main issue I am having is that Perl's default encoding is UTF-8
and I am mostly certain that the string is a UTF-16 string.
What I need is Perl code that can convert a long hex multi-string like
above (without the commas and backslashes) into a readable UTF-16
string. Thanks. |