Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^13: Determining content-length for an HTTP Post

by WizardOfUz (Friar)
on Nov 27, 2009 at 18:05 UTC ( [id://809783]=note: print w/replies, xml ) Need Help??


in reply to Re^12: Determining content-length for an HTTP Post
in thread Determining content-length for an HTTP Post

Do you turn off use strict; and use warnings; when they start issuing messages?

Actually, I was hoping for a "Wide character in print ..." warning (and a correct Content-Length header). That would have solved the whole mystery ...

But enough of that. The funny thing is, I'm currently writing a web framework and one of the design decisions I have not made yet is whether to allow a character string as the response body or not, because of this whole bytes / print issue. So I would really like to see a real world example where Perl gets the length in bytes of a string wrong when compared to the number of bytes actually printed, assuming no PerlIO layer and no direct manipulation of the string's UTF-8 flag.

Replies are listed 'Best First'.
Re^14: Determining content-length for an HTTP Post
by Corion (Patriarch) on Nov 27, 2009 at 18:11 UTC

    This is only true if you output utf8 and your Perl is built to use utf8 as its internal Unicode representation. If any of the two changes, { use bytes; length } will not give the correct results anymore.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-25 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found