RT 4.0.24 Documentation

This version has reached its end of life and is out of support. Please contact us for upgrade assistance.

RT::I18N

Go to latest version →

NAME

RT::I18N - a base class for localization of RT

Init

Initializes the lexicons used for localization.

encoding

Returns the encoding of the current lexicon, as yanked out of __ContentType's "charset" field. If it can't find anything, it returns 'ISO-8859-1'

SetMIMEEntityToUTF8 $entity

An utility function which will try to convert entity body into utf8. It's now a wrap-up of SetMIMEEntityToEncoding($entity, 'utf-8').

IsTextualContentType $type

An utility function that determines whether $type is textual, meaning that it can sensibly be converted to Unicode text.

Currently, it returns true iff $type matches this regular expression (case-insensitively):

    ^(?:text/(?:plain|html)|message/rfc822)\b

SetMIMEEntityToEncoding $entity, $encoding

An utility function which will try to convert entity body into specified charset encoding (encoded as octets, *not* unicode-strings). It will iterate all the entities in $entity, and try to convert each one into specified charset if whose Content-Type is 'text/plain'.

This function doesn't return anything meaningful.

DecodeMIMEWordsToUTF8 $raw

An utility method which mimics MIME::Words::decode_mimewords, but only limited functionality. Despite its name, this function returns the bytes of the string, in UTF-8.

_FindOrGuessCharset MIME::Entity, $head_only

When handed a MIME::Entity will first attempt to read what charset the message is encoded in. Failing that, will use Encode::Guess to try to figure it out

If $head_only is true, only guesses charset for head parts. This is because header's encoding (e.g. filename="...") may be different from that of body's.

_GuessCharset STRING

use Encode::Guess to try to figure it out the string's encoding.

_CanonicalizeCharset NAME

canonicalize charset, return lowercase version. special cases are: gb2312 => gbk, utf8 => utf-8

SetMIMEHeadToEncoding HEAD OLD_CHARSET NEW_CHARSET

Converts a MIME Head from one encoding to another. This totally violates the RFC. We should never need this. But, Surprise!, MUAs are badly broken and do this kind of stuff all the time

← Back to index