in reply to Encodings problem

Hello, is there a way to avoid this rncoding transformaions from greek-iso to utf8 and the other way around?

Erm.. Yeah. Just use UTF8 for everything in the files and 7-bit ASCII for the filenames. It'll save you a load of troubles. Also, Encode does not do anything with XML/HTML numeric entities, and you shouldn't need them if you "use utf8" in your script.

And PLEASE try to remember you shouldn't trust remote users' input. i.e. do not trust the user to enter a valid filename. I've had way too many discussions with you about that already.

update: I thought this node seemed familiar. And here, and here. If you're still having problems with the same code after 7 months, please be so kind as to point to earlier posts about it. Especially since your posts are VERY difficult to understand, so every little bit helps.

update 2: as far as I can see your big problem is NOT that your using UTF8 encoding for the filenames, it's that you're using XML numeric entities instead of proper UTF8 strings. I.e. don't use "ÿ" use "\x{ff}".

Replies are listed 'Best First'.
Re^2: Encodings problem
by Nik (Initiate) on Oct 07, 2006 at 22:03 UTC
    But i dont useXML numeric entitiesnowhere. Thsi just happens when i copy/paste from the script to show you here. ps. I need the use rto select a filename but many try backware directory traversal trichsk. How do i properly insure that what will i get form the user will be only a filename with an dnot a string that contains dots and backslashes? ps2: are you sure that windows is able to save the filanems in pure utf8? if yes my files arent showed up normally but insated i ahve t use the encode function? Iam very confused about this.
      Well, how about you make a small, selfcontained program that demonstrates your problem (i.e. reading/writing files with UTF8 filenames - it shouldn't take more than 5 - 10 lines - and I do not mean a CGI program that needs lots of other files - just a simple command line program is much better) and if that still shows the problem, post it here along with a clear description of the problem involving at least the full program, the expected output and the actual output. you should know the deal by now.

      Also, I realize you're greek and english isn't your native language, but PLEASE try to spell at least the simple words like "this", "to" and "don't" correctly. A spelling error here or there isn't a problem but this is just very annoying to read.

      Now, one important tip: almost all the time you do not want to use Encode::from_to. You'll want to use Encode::encode (from utf8 to some other encoding) and Encode::decode (from some encoding to utf8). see the docs.