Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^3: Weird encoding after grabing filenames

by graff (Chancellor)
on Jun 16, 2009 at 20:53 UTC ( #772140=note: print w/replies, xml ) Need Help??

in reply to Re^2: Weird encoding after grabing filenames
in thread Weird encoding after grabing filenames

When I visited your web page (, I was able to get a sensible display by telling my browser to treat the page as iso-8859-7 (greek). But I gather you want the text to be in utf8, which I think would be a good idea.

As you follow moritz's good advice, you have to respect the docs regarding Encode::from_to(). Here's an easy way to do the required loop in a single line of code:

Encode::from_to($_, 'ISO-8859-7', 'utf8') for (@menu_files);
The reason why the path strings are showing up fine is because they are just plain ascii characters; it's only the file names that are non-ascii, and if the web server and browser don't agree on what the encoding is for those non-ascii characters, it's just noise.

(updated to fix grammar in first sentence)

Replies are listed 'Best First'.
Re^4: Weird encoding after grabing filenames
by Nik on Jun 17, 2009 at 09:49 UTC
    Thank you very much that was waht i needed.

    Allow me to ask this: Why only the path strings were plain ascii chars and the filenames were non-ascii which lead me to the extra use of Encode::from_to() to show it properly?

    Does it has to do with the way(type of encoding) Vista encoded its filenames? And if this is the case here why encode the folders differently?

      Because some characters are encoded the same in both ISO-8859-7 and UTF-8. So even though you program was buggy, you still happened to get some correct output.

        But the data that actually got prined correctly weren't greek characters. They were data composed of english letters like "/home/nikos/public_html/data/text".

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://772140]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2021-09-24 00:00 GMT
Find Nodes?
    Voting Booth?

    No recent polls found