What content encoding does the default Perl CGI script use?

I am modifying a mature CGI application written in Perl and I have a question about content encoding. The browser reports that the content is encoded by iso-8859-1, and the application declares iso-8859-1 as the encoding in the HTTP headers, but it never seems to really do the encoding. None of the different coding methods described in the perldoc tutorials ( Encode , Encoding , Open ) are used in the code, so I'm a bit confused about how the document is actually encoded.

As already mentioned, the application is quite mature and probably precedes many of the existing encoding methods. Does anyone know of any obsolete or obsolete methods that I should look for? What encoding does Perl accept / default when the developer does not provide a direction?

thank

+3
source share
4 answers

By default, Perl treats strings as byte sequences, so if you read from a file and print it to STDOUT, it will call a sequence of bytes. If your patterns are Latin-1, your output will also be Latin-1.

If you use a string in the context of a text string (e.g., c uc, lcetc.), perl assumes Latin-1 semantics, unless the string has been decrypted before.

Perl,

+8

Perl , , . , , , .

HTTP Content-Type.

+2

, , . , , , .

script , , . CGI ( nph), , , , , .

+1

If the browser reports the content as iso-8859-1, maybe your perl script does not output the correct headers to indicate the encoding?

0
source

Source: https://habr.com/ru/post/1697998/


All Articles