Re: [mp1] binmode(STDOUT, ':utf8') fails silently

[prev] [thread] [next] [Date index for 2005/05/05]

From: Brian Dimeler
Subject: Re: [mp1] binmode(STDOUT, ':utf8') fails silently
Date: 19:02 on 05 May 2005
Ha, nevermind, I figured it out. Turns out that when a param was sent to the script indicating a 
cookie should be changed, it was using CGI's header() function to generate the header rather than my 
header text. Adding -charset => 'UTF-8' to header() did the trick, naturally.

Still curious about binmode(), though; is there some mod_perl-specific reason that it would fail?

Brian Dimeler wrote:

> Hi, I'm trying to set binmode(STDOUT, ':utf8') from within a PerlRun 
> script (mod_perl 1.29, apache 1.3.29, perl 5.8.6), and it's failing 
> (returning undef) without setting $!, as the docs claim it should.
> 
> I really shouldn't even have to do this at all, since I'm already setting
> 
> Content-type: text/html; charset=UTF-8
> 
> as the header,
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> at the start of the document AND, just to be thorough,
> 
> <meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
> 
> in the <head> section of all my generated HTML. When I invoke my script 
> at the command line, the output shows up in the terminal with the proper 
> unicode characters. Málaga is Málaga. But the same script, when run by 
> mod_perl, sends "Málaga" to the browser instead. Why is this, and why 
> is it that the only obvious workaround, binmode(), has decided to 
> quietly quit? (and yes, I'm setting binmode() before using print() for 
> for the first time).
> 
> Let me know if that's not enough information. Unfortunately I cannot 
> post the entire script in a public forum.
> 

[mp1] binmode(STDOUT, ':utf8') fails silently
Brian Dimeler 18:15 on 05 May 2005

Re: [mp1] binmode(STDOUT, ':utf8') fails silently
Brian Dimeler 19:02 on 05 May 2005

Re: [mp1] binmode(STDOUT, ':utf8') fails silently
Markus Wichitill 19:19 on 05 May 2005

Generated at 06:56 on 17 May 2005 by mariachi v0.52