in reply to convert encoding

See Encode - assuming that you have not added any decoding/encoding yet, you would decode the string on reading in and encode the string on output:

use Encode qw( decode encode ); my $str = decode('Latin-1', "Nach R\x{fc}cksprache mit"); # ... whatever # Assume that STDOUT is UTF-8: my $str_out = encode( 'UTF-8', $str ); print $str;

As you don't tell us the encoding of your input and the encoding you need in your output, it's hard to give more concrete advice.

Replies are listed 'Best First'.
Re^2: convert encoding
by rumpumpel1 (Novice) on Feb 23, 2017 at 09:36 UTC

    using your example code the output still shows "Nach R\x{fc}cksprache mit".

    For output I would like to have utf8. Unfortunately I don't know what the input encoding is.

      The output of Data::Dumper will always show Nach R\x{fc}cksprache mit because Data::Dumper tries to restrict its output to 7-bit ASCII, at least with some options.

      If you want something else, please show a SSCCESCCEE, because I don't really understand what you're asking for and it's most easy to demonstrate in ten lines of code.

        use strict; use Lyo::OSLC::CQ::CM; use Data::Dumper; use Encode qw(encode decode); ... my $client = Lyo::OSLC::CQ::CM->new; ... my $data = $client->oslcWhere(...); # get data from ClearQuest my $xml = Dumper($data); my $xml_out = encode('UTF-8', $xml); print $xml_out;