Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Wide character at C:\perl-lib-ctp/Fmsc.pm line 27, <INFILE> line 1.

by Anonymous Monk
on Dec 26, 2021 at 16:53 UTC ( [id://11139914]=note: print w/replies, xml ) Need Help??


in reply to Re: Wide character at C:\perl-lib-ctp/Fmsc.pm line 27, <INFILE> line 1.
in thread Wide character at C:\perl-lib-ctp/Fmsc.pm line 27, <INFILE> line 1.

Slight correction: the "<:utf8" asserts that the input file is UTF-8, and it is decoded as such. The preferred mode for this case these days is "<:encoding(utf-8)", which actually checks the encoding, failing if an invalid encoding is encountered. Yes, "<:utf8" appeared in older Perl documentation, which shows that better people than me failed to appreciate the distinction in the early going. It is mostly gone now.

Replies are listed 'Best First'.
Re^3: Wide character at C:\perl-lib-ctp/Fmsc.pm line 27, <INFILE> line 1.
by frank5us (Initiate) on Dec 26, 2021 at 23:04 UTC
    Thanks, I've incorporated that. When I write the utf-8 as a file, do I also need to wrap it with that check?
    ###################################################################### +################## sub write_file_utf8 { my $outfilename= shift; # appears in browser tabs my $outstr = shift; # file as a string ################################################################## +############## open OUTFILE, ">:utf8" , $outfilename or die "cannot open >:utf8 $outfilename: $!"; #binmode STDOUT, ":utf8"; print OUTFILE $outstr, "\n"; close(OUTFILE); } #sub

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11139914]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 06:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found