Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating ".inf" file using following command using perl program.

system("secedit /export /areas USER_RIGHTS /cfg ".$path);

Next, I want to open this file and search for a string. But while opening this file it is not opening in standard format rather some other format,between each letter space is coming, so it was not able to search that string.
I need to encode this file to utf-8.

How to do this???

What I have tried:

I tried this code to encode my file, but it is not working,

my $hdlFile = open(my $fh, "<:encoding(UTF-8)", $strFilePath)
|| die "Can't open UTF-8 encoded $strFilePath: $!";
Posted
Updated 21-May-17 21:06pm
v2
Comments
Richard MacCutchan 22-May-17 5:13am    
See if there is an option in secedit to create the file in UTF-8 rather than Unicode.
Member 13209843 23-May-17 2:46am    
I got the answer. Actually file contains hexadecimal value. So we need to use utf-16.

Thanq ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900