Solved

Apache, mod_perl and utf-8

Posted on 2007-12-07
4
825 Views
Last Modified: 2013-11-13
Hy all

I'm getting crazy with mod_perl and utf-8. I already did everything that I found in the web about this and nothing works.

use Encode;
use utf8;

sub handler() {
      my $r = shift;
      $r->content_type('text/html; charset=utf-8');
      
      my $output = "<html><body>aécãcça ".time."</body></html>";
      
#      utf8::encode $output;
#      $r->print(Encode::encode('utf-8', $output));
      $r->print($output);
}


I don't know if this shall be about configuration.

PLEASE HELP, This is my first website done from 0, and I'm getting crazy.

Thanks
0
Comment
Question by:oleber
4 Comments
 
LVL 10

Accepted Solution

by:
oleber earned 0 total points
ID: 20426400
Solved:

sub handler() {
      my $r = shift;
      $r->content_type('text/html; charset=utf-8');
      $r->send_http_header();
            
      my $output = "<html><body>aécãcça ".time."</body></html>";

      $r->print($output);
}
0
 
LVL 39

Expert Comment

by:Adam314
ID: 20442962
From the solution, I'm guessing the problem was you weren't sending proper headers before.
If you add this to your script, the errors will show up on the browser, instead of in the logs.  This can make it easier to debug:
use CGI::Carp 'fatalsToBrowser';
0
 
LVL 1

Expert Comment

by:Vee_Mod
ID: 20554883
Closed, 125 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWS EC2 & RDS Instance 5 62
Recover unsaved Tab contents (and settings/preferences) from Notepad++ 3 115
Perl Snippet to Parse String 1 34
Java array 10 54
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question