I found the solution in the activestate forum: http://community.activestate.com/forum-topic/creating-unicode-utf-16le. You need to use File::BOM and open the file as following:layers :raw:encoding(UTF-16LE):crlf:via(File::BOM): unixencoding(UTF-16LE)utf8crlfutf8viautf8 layers :encoding(UTF-16LE): unixcrlfencoding(UTF-16LE)utf8 :raw:encoding(UTF-16LE): unixencoding(UTF-16LE)utf8
The same problem is described there. I don't know what this line is doing, any comments of unicode and Perl insiders are welcome. I assume this writes newline using this File::BOM module and this way the byte order is correct. My script is now writing pretty fine output. I exported the whole HKLM/Software and had only few differences. This is a value I can live with. If I export only the sub-tree of my interest the file is completely identical to the output of regedit.exe. Thank you for your help.open my $fh, '>:raw:encoding(UTF-16LE):crlf:via(File::BOM)', 'file.reg +';
In reply to Re^5: Win32 registry export
by wwe
in thread Win32 registry export
by wwe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |