Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Encoding changed from Greek to somethign else

by Nik (Initiate)
on Jul 17, 2007 at 11:41 UTC ( #627006=perlquestion: print w/replies, xml ) Need Help??

Nik has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Encoding changed from Greek to somethign else

Replies are listed 'Best First'.
Re: Encoding changed from Greek to somethign else
by ikegami (Patriarch) on Jul 17, 2007 at 14:51 UTC

    Your document claims its encoded using iso‑8859‑1, but that's wrong.

    Judging by the repetition patterns when viewed as iso‑8859‑1, it's actually encoded using a multi-byte encoding such as UTF-8. iso‑8859‑* are single-byte encodings.

    The most likely encoding would be UTF‑8. However, when viewed as UTF‑8, you still see the telltale repetition pattern of a multi-byte encoding.

    I suspect you did the equivalent of

    print(encode('UTF-8', encode('UTF-8', $s)));
    A reply falls below the community's threshold of quality. You may see it by logging in.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Encoding changed from Greek to somethign else
by daxim (Curate) on Jul 20, 2007 at 03:23 UTC

    You mention Notepad.

    1. case - you have your data all as hardcoded string in index.pl
    2. Include the pragma use utf8; in the index.pl. Make sure to select UTF-8 encoding when saving the file.

    3. case - you have your data in an outside file
    4. I assume your data is in Windows-1253. When reading it into variables, decode it. Or handle the decoding automatically through an IO layer during opening the file:

      open my $fh, '<:encoding(windows-1253)', 'filename.dat' or die "could +not open filename.dat for reading: $!";
    When writing the XHTML out:
    • Set the proper HTTP header.
      header('Content-Type' => 'application/xml+xhtml;charset=UTF-8');
    • Encode all text and variable contents that's going out to produce the web page:
      binmode STDOUT, ':utf8';
    • Set the proper XML PI.
      print '<?xml version="1.0" encoding="UTF-8"?>';

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Encoding changed from Greek to somethign else
by Anonymous Monk on Jul 18, 2007 at 06:54 UTC
    Its Greek to you, huh? lol
      Actuall we Greeks, when something is weird to us we say "This all sounds Chinese to me" :) while the other people non Greeks claims its all Greek to them...
Re: Encoding changed from Greek to somethign else
by Anonymous Monk on Jul 24, 2007 at 08:04 UTC

    Ur right, this isn't a PERL problem but I'll help you anyway. You need to reverse the polarity on the inputted file. For this you need either a Hydrospanner (I don't think one exists wich is written in PERL, but there are ones in PHP, which is a better language anyway so just use that) or the SonicScrewdriver program written by Linus Torvalds, you can get it at www.fsf.org.

    BTW I think ur site has been transmogrified?

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2022-06-28 00:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (89 votes). Check out past polls.

    Notices?