in reply to Tk Photo method

Your code tries to read a file name containing lots of ampersands, digits, pound signs, and semicolons. Do you really want to do that?

Perl is not HTML, you may want to write \x{1234} inside double quotes instead of Ӓ inside single quotes.

But then, filenames are BYTE STREAMS for Perl. If your local system convention is that the file name byte streams represent UTF-8 encoded names, you need to convert your unicode string into the equivalent UTF-8 byte stream. Encode can help you with that, using $byte_stream=encode('utf8',$name) or $byte_stream=encode_utf8($name).

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: Tk Photo method
by Anonymous Monk on Nov 26, 2010 at 16:03 UTC
    This filename eq name with 12 cyrylic chars with charcodes which was shown by perlmonks site. This Perlmonks site not show international utf-8 chars. It show only latin chars.
    This filename was like $filename='/home/user/ABCDEFRGHTHT.jpg'
    where big chars was a cyrylic chars. I needn't enter filenames as \x{1234}. I show this only as example.
    I get filenames by filedialog and save it in variable $filename for example.
    I use in code directive
    use utf8;
    and I can open files by open(F,'<:raw',...) function with encoding or decoding by Encode module...
    This all works with standart functions but not work with Tk. I write about this in (http://www.perlmonks.org/?node_id=873529). Tk functions good work only with codepage iso8859-1.
    I am correcting FDialog for utf8(but this work fine only on unix. Now I have problem with chdir and cwd functions in win32).
    But now I see problem with Photo method. And this is problem for me. I can't correcting method Photo for himself too...
    Can I load .jpg file to pointer in memory and use it in any way in Tk? Or may be present another methods...
    I see in Image::Magick I can load picture by Read function, but I can load it by standard open function and use pointer to this picture in Image::Magick. May be in Tk I can use some any method for loading picture too?
      Previous message was mine...
      For correct this problem I create this sub:
      sub myPhoto { my $f=shift; copy($f,fn($tmpdir.'myphototmp')); $TOP->Photo(-file=>$tmpdir.'myphototmp'); }
      and use it in code as:
      createImage(x,y,-image=>myPhoto($filename));

      This is some slowly but it work!

      P.S.: I mean Perl/Tk and UTF-8 international support get for me many new surprises.