Home
TeamSite
UTF-8 to iso-8859-1(PERL)
patrickm
Hi all,
First Post in here!!
Anyhows I'm having a problem within a TPL. After parsing the DCRs XML I'm using the function encode_entities() (HTML::entities) to esape foreign characters in my outputted HTML. Parsing returns UTF-8 content (with all those nasty A's), but to use encode_entities() I need to convert to iso-8859-1. Perl 5.8 uses the utf8.pm module, which allows you to decode easily, but this is proving to be very difficult in teamsite. Has anyone been able to sucessfully convert from UTF-8 to iso-8859-1?
Find more posts tagged with
Comments
Migrateduser
I have not specifically had to do this in the past, but if I had to guess, I would say this will do it:
TeamSite::I18N_utils::utf8_to_other_encoding();
=head1 utf8_to_other_encoding($destination_encoding, $utf8_string)
Global function.
Returns a transfomed version of $utf8_string
into the encoding specified by $destination_encoding;
encoding aliases are handled automatically by applying
promote_encoding() to $destination_encoding prior to
the actual transcoding step.
If $destination_encoding is unsupported, this function
will 'die' with an error message.
Does not modify $utf8_string
=cut
--
Jed Michnowicz
Interwoven Technical Consultant
patrickm
Brilliant - works a treat!