Perl latin-9? Unicode - need to add support
Posted
by Phill Pafford
on Stack Overflow
See other posts from Stack Overflow
or by Phill Pafford
Published on 2010-06-14T17:56:49Z
Indexed on
2010/06/14
18:02 UTC
Read the original article
Hit count: 273
I have an application that is being expanded to the UK and I will need to add support for Latin-9 Unicode. I have done some Googling but found nothing solid as to what is involved in the process. Any tips?
Here is some code (Just the bits for Unicode stuff)
use Unicode::String qw(utf8 latin1 utf16);
# How to call
$encoded_txt = $self->unicode_encode($item->{value});
# Function part
sub unicode_encode {
shift() if ref($_[0]);
my $toencode = shift();
return undef unless defined($toencode);
Unicode::String->stringify_as("utf8");
my $unicode_str = Unicode::String->new();
# encode Perl UTF-8 string into latin1 Unicode::String
# - currently only Basic Latin and Latin 1 Supplement
# are supported here due to issues with Unicode::String .
$unicode_str->latin1( $toencode );
...
Any help would be great and thanks.
© Stack Overflow or respective owner