I don't understand why you find this to be such an annoyance. Do you have the ability to tell Windows which character encoding it should use when storing file names in directories? (That isn't a Perl question, and I'm not a Windows user, so I don't know.)

If you can make your Windows system use utf8 for the file names, do that, so that the character encoding of the file names matches the character encoding of your web/cgi data.

If Windows will only use iso-8859 for file names in Greek, then your choices are limited to:

  1. Do all your web/cgi data in iso-8859, to match the encoding used in file names, or else
  2. Keep the web/cgi content in utf8, and just transliterate file name strings from one encoding to the other when you have to.
It's really not that big a deal either way, but personally, if I had a lot of web content in utf8 already, and I couldn't get windows to use utf8 for file names, then I think using Encode like you're doing now would be a lot cheaper, easier and quicker than changing all the web content.

You could just set up a module of your own that implements "utf8-to-iso" versions "open", "opendir", "readir" and maybe "glob" -- you could give them names like "gr_open" or whatever, and your cgi scripts then just need to use that module and call those functions instead of the "standard" ones.

Each function in the module would handle the encoding conversions internally, taking utf8 strings as args and giving back utf8 strings as return values. That way, you don't have to keep rewriting the same encoding conversion code over and over again.


In reply to Re: Encodings problem by graff
in thread Encodings problem by Nik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.