Re: Assigning another filehandle to STDOUT, using binmode.



On 2007-06-25, Peter J. Holzer wrote:

On 2007-06-25 10:28, Adam Funk <a24061@xxxxxxxxxxxxx> wrote:
As far as I can tell, I'm not getting errors or warnings reading the
input files (but I'm not doing it directly with my own code --- I'm
using XML::Twig's parsefile($input_filename) method; the input files
are XML with Cyrillic UTF-8 PCDATA) --- does Perl by default take the
environment into consideration,

No. By default it assumes (on Unix) binary input. You are reading and
writing a stream of bytes, not a stream of characters.

or assume UTF-8, for input but not output?

No. The XML parser gets the encoding from the XML file. If the XML file
doesn't explicitely specify an encoding, it must be UTF-8. This is
completely independent of the locale. XML files are supposed to be
portable and must not be interpreted differently depending on the
locale.

Oh of course! I got so caught in up in this business of setting
encodings that I forgot about the encoding specified explicitly in the
XML file.
.



Relevant Pages

  • Re: Assigning another filehandle to STDOUT, using binmode.
    ... input files (but I'm not doing it directly with my own code --- I'm ... The XML parser gets the encoding from the XML file. ... completely independent of the locale. ...
    (comp.lang.perl.misc)
  • Re: How to encode a UTF8 file in VBA?
    ... and open the XML file in Internet Explorer. ... Explorer will complain if the encoding of the XML file doesn't match the ... Dim objStream As Stream ...
    (microsoft.public.access.modulesdaovba)
  • Re: Character Set Problem?
    ... was no problem until I created a test file with accented characters, ... so the actual encoding and the declaration did not match. ... I have an Access 2002 database that imports an XML file. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Error reading XML file through XML Receive default pipeline
    ... I think it indeed was an encoding problem. ... edited input files using a non-Unicode aware editor. ... Do you have a processing instruction preceding the Xml ... tutorial there were some steps in which one has to specify Schema Editor ...
    (microsoft.public.biztalk.general)
  • XML::DOM Encoding UTF-8 and ISO-8859-1
    ... the XML file: ... Through a CGI script, I load up the file, grab the encoding and put in ... the CGI header: ... If I change the CGI header encoding to UTF-8 like such: ...
    (comp.lang.perl.misc)

Loading