develooper Front page | perl.libwww | Postings from March 2003

Unicode POST problem

Thread Next
From:
Dominic Mitchell
Date:
March 12, 2003 04:05
Subject:
Unicode POST problem
Message ID:
b4n3j7$ol8$1@paprika.rp.lan
I'm trying to upload a file to a server, but it's failing because the 
content-length is incorrect.  This is because the content is UTF-8 and 
length() is reporting characters, not bytes.

Attached is a small test to demonstrate this.

I would imagine that somewhere in the bowels of HTTP::Request, 
bytes::length() needs to be used instead of the default CORE::length(), 
which reports characters.  Or maybe call decode('utf8', $content).  But 
that would involve knowing more about the character sets in use...

Many thanks,
-Dom

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About