How to handle characters like ü, Ö etc. I tried using decode_utf8() function. But still when I print the string I get some funny characters instead of
ü or Ö

If you run perl and your script from the command-line interface in a DOS window or a Terminal in linux and print to STDIN then maybe the DOS or Terminal can't print those characters. I think that depends on the platform. However if you print something encoded as utf-8 to a file and read it with an editor or viewer that can read utf-8 encoded files you should see the characters you expect.

Can you post a simple script that demonstrates the problem so we can reproduce the problematic output?

use Encode;
open (FILEHANDLE, '<specialchar.txt');
$file = <FILEHANDLE>;
$f = decode_utf8($file);
open (FF, '>print.txt');
print FF $f;


� or �

ya you are right , the encoding for my notepad was ansi, therefore I was getting error.


Hi Phoenixlnsilico,
Your posted code could also be written like so,

my $input_file='specialchar.txt';

open my $fh2, '>:encoding(UTF-8)', 'print.txt'
  or die "can't open file: $!";    # file to write to
open my $fh, '<:encoding(UTF-8)', $input_file
  or die "can't open $input_file: $!";    # file to read from
binmode $fh,":encoding(UTF-8)";
while (<$fh>) {
    print {$fh2} $_,$/;
close $fh  or die "can't close file: $!";
close $fh2 or die "can't close file: $!";

That should give you what you want!
Hope this helps