in reply to Re^3: Difficulty with UTF-8 and file contents
in thread Difficulty with UTF-8 and file contents
So if I guess right, the use of a file handle which I have opened myself under the influence of the use open qw/:std :utf8/; pragma forced the data going into HTML::TreeBuilder::XPath to be read as UTF-8?
Yes, that's correct. Note the documentation of parse_file in HTML::TreeBuilder:
... When you pass a filename to parse_file, HTML::Parser opens it in binary mode, which means it's interpreted as Latin-1 (ISO-8859-1). If the file is in another encoding, like UTF-8 or UTF-16, this will not do the right thing. One solution is to open the file yourself using the proper :encoding layer, and pass the filehandle to parse_file. ...
|
|---|