in reply to Bizarre UTF8 issue with strings

Is $country_name a decoded string? What about $title? is use utf8; in scope? Is there any output layer involved?

(with "decoded string" I mean one that has gone through Encode::decode() or related functions, or through an :encoding(UTF-8) or :utf8 IO layer).

See also: Encodings and Unicode in Perl.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: Bizarre UTF8 issue with strings
by ultranerds (Hermit) on Sep 17, 2010 at 16:44 UTC
    Hi,

    Thanks for the replies guys.

    The file being read is already in "UTF8 without BOM"

    The $country_name is a basic string (a-z0-9 etc)

    I tried doing:

    use Encode qw( encode ); $country_name = encode('utf8', $country_name);


    ..and that seems to have done the trick.

    Man wish I had realised this hours ago.

    Thanks a ton for the replies - you've saved my remaining hair ;)

    Cheers

    Andy