Thanks for all your inputs.
@stevieb: I think the problem is at line 50 in the file which I am guessing from the error I see after adding
:encoding(UTF-8)
in filehandle at line 17 which now looks like
open(my $fh, "<:encoding(UTF-8)", "20150626102938.txt")
(Thanks to AnomalousMonk for sugestion)
I am on perl v5.10.1 at present and will see if can get it upgraded but it'll be a while before I can get it done.
@AnomalousMonk: I was trying to do this
perl -pe's/\x08//g' <20150625163139.xml >20150625163139.xml
from the code. And I tried using two different file names as well. I just kept getting same error so just left it there. But if I can get it working, then I'll ensure to use two different files there.
I am sorry for causing confusion about 20150625163139.xml. It is just an existing text file (generated at run time) which I have to use to generate xml. I can change it's extension to .txt though.
I tried adding
:encoding(UTF-8)
in filehandle at line 17 which now looks like
open(my $fh, "<:encoding(UTF-8)", "20150626102938.txt")
Before adding the output of script was:
Code point \u0016 is not a valid character in XML at ./Call_to_snmpwal
+k_V_1.pl line 34
After adding the output of script was:
utf8 "\xB8" does not map to Unicode at ./Call_to_snmpwalk_V_1.pl line
+35, <$fh> line 50.
utf8 "\xF3" does not map to Unicode at ./Call_to_snmpwalk_V_1.pl line
+35, <$fh> line 50.
Code point \u0016 is not a valid character in XML at ./Call_to_snmpwal
+k_V_1.pl line 34
@sundialsvc4: I am sorry for confusion caused by 20150625163139.xml It's just text file with no <?xml version="1.0" encoding="UTF-16" standalone="no"?> at the top
I tried adding that tag manually at the top in file 20150625163139.xml just to give it a try but it still gives same error with and without :encoding(UTF-8) added in filehandle
@afoken: Thanks for adding the context link.
|